<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <title>Web Bluetooth Scanning</title>
<style data-fill-with="stylesheet">/******************************************************************************
 *                   Style sheet for the W3C specifications                   *
 *
 * Special classes handled by this style sheet include:
 *
 * Indices
 *   - .toc for the Table of Contents (<ol class="toc">)
 *     + <span class="secno"> for the section numbers
 *   - #toc for the Table of Contents (<nav id="toc">)
 *   - ul.index for Indices (<a href="#ref">term</a><span>, in §N.M</span>)
 *   - table.index for Index Tables (e.g. for properties or elements)
 *
 * Structural Markup
 *   - table.data for general data tables
 *     -> use 'scope' attribute, <colgroup>, <thead>, and <tbody> for best results !
 *     -> use <table class='complex data'> for extra-complex tables
 *     -> use <td class='long'> for paragraph-length cell content
 *     -> use <td class='pre'> when manual line breaks/indentation would help readability
 *   - dl.switch for switch statements
 *   - ol.algorithm for algorithms (helps to visualize nesting)
 *   - .figure and .caption (HTML4) and figure and figcaption (HTML5)
 *     -> .sidefigure for right-floated figures
 *   - ins/del
 *
 * Code
 *   - pre and code
 *
 * Special Sections
 *   - .note       for informative notes             (div, p, span, aside, details)
 *   - .example    for informative examples          (div, p, pre, span)
 *   - .issue      for issues                        (div, p, span)
 *   - .assertion  for assertions                    (div, p, span)
 *   - .advisement for loud normative statements     (div, p, strong)
 *   - .annoying-warning for spec obsoletion notices (div, aside, details)
 *
 * Definition Boxes
 *   - pre.def   for WebIDL definitions
 *   - table.def for tables that define other entities (e.g. CSS properties)
 *   - dl.def    for definition lists that define other entitles (e.g. HTML elements)
 *
 * Numbering
 *   - .secno for section numbers in .toc and headings (<span class='secno'>3.2</span>)
 *   - .marker for source-inserted example/figure/issue numbers (<span class='marker'>Issue 4</span>)
 *   - ::before styled for CSS-generated issue/example/figure numbers:
 *     -> Documents wishing to use this only need to add
 *        figcaption::before,
 *        .caption::before { content: "Figure "  counter(figure) " ";  }
 *        .example::before { content: "Example " counter(example) " "; }
 *        .issue::before   { content: "Issue "   counter(issue) " ";   }
 *
 * Header Stuff (ignore, just don't conflict with these classes)
 *   - .head for the header
 *   - .copyright for the copyright
 *
 * Miscellaneous
 *   - .overlarge for things that should be as wide as possible, even if
 *     that overflows the body text area. This can be used on an item or
 *     on its container, depending on the effect desired.
 *     Note that this styling basically doesn't help at all when printing,
 *     since A4 paper isn't much wider than the max-width here.
 *     It's better to design things to fit into a narrower measure if possible.
 *   - js-added ToC jump links (see fixup.js)
 *
 ******************************************************************************/

/******************************************************************************/
/*                                   Body                                     */
/******************************************************************************/

	body {
		counter-reset: example figure issue;

		/* Layout */
		max-width: 50em;               /* limit line length to 50em for readability   */
		margin: 0 auto;                /* center text within page                     */
		padding: 1.6em 1.5em 2em 50px; /* assume 16px font size for downlevel clients */
		padding: 1.6em 1.5em 2em calc(26px + 1.5em); /* leave space for status flag     */

		/* Typography */
		line-height: 1.5;
		font-family: sans-serif;
		widows: 2;
		orphans: 2;
		word-wrap: break-word;
		overflow-wrap: break-word;
		hyphens: auto;

		/* Colors */
		color: black;
		background: white top left fixed no-repeat;
		background-size: 25px auto;
	}


/******************************************************************************/
/*                         Front Matter & Navigation                          */
/******************************************************************************/

/** Header ********************************************************************/

	div.head { margin-bottom: 1em }
	div.head hr { border-style: solid; }

	div.head h1 {
		font-weight: bold;
		margin: 0 0 .1em;
		font-size: 220%;
	}

	div.head h2 { margin-bottom: 1.5em;}

/** W3C Logo ******************************************************************/

	.head .logo {
		float: right;
		margin: 0.4rem 0 0.2rem .4rem;
	}

	.head img[src*="logos/W3C"] {
		display: block;
		border: solid #1a5e9a;
		border-width: .65rem .7rem .6rem;
		border-radius: .4rem;
		background: #1a5e9a;
		color: white;
		font-weight: bold;
	}

	.head a:hover > img[src*="logos/W3C"],
	.head a:focus > img[src*="logos/W3C"] {
		opacity: .8;
	}

	.head a:active > img[src*="logos/W3C"] {
		background: #c00;
		border-color: #c00;
	}

	/* see also additional rules in Link Styling section */

/** Copyright *****************************************************************/

	p.copyright,
	p.copyright small { font-size: small }

/** Back to Top / ToC Toggle **************************************************/

	@media print {
		#toc-nav {
			display: none;
		}
	}
	@media not print {
		#toc-nav {
			position: fixed;
			z-index: 2;
			bottom: 0; left: 0;
			margin: 0;
			min-width: 1.33em;
			border-top-right-radius: 2rem;
			box-shadow: 0 0 2px;
			font-size: 1.5em;
			color: black;
		}
		#toc-nav > a {
			display: block;
			white-space: nowrap;

			height: 1.33em;
			padding: .1em 0.3em;
			margin: 0;

			background: white;
			box-shadow: 0 0 2px;
			border: none;
			border-top-right-radius: 1.33em;
			background: white;
		}
		#toc-nav > #toc-jump {
			padding-bottom: 2em;
			margin-bottom: -1.9em;
		}

		#toc-nav > a:hover,
		#toc-nav > a:focus {
			background: #f8f8f8;
		}
		#toc-nav > a:not(:hover):not(:focus) {
			color: #707070;
		}

		/* statusbar gets in the way on keyboard focus; remove once browsers fix */
		#toc-nav > a[href="#toc"]:not(:hover):focus:last-child {
			padding-bottom: 1.5rem;
		}

		#toc-nav:not(:hover) > a:not(:focus) > span + span {
			/* Ideally this uses :focus-within on #toc-nav */
			display: none;
		}
		#toc-nav > a > span + span {
			padding-right: 0.2em;
		}

		#toc-toggle-inline {
			vertical-align: 0.05em;
			font-size: 80%;
			color: gray;
			color: hsla(203,20%,40%,.7);
			border-style: none;
			background: transparent;
			position: relative;
		}
		#toc-toggle-inline:hover:not(:active),
		#toc-toggle-inline:focus:not(:active) {
			text-shadow: 1px 1px silver;
			top: -1px;
			left: -1px;
		}

		#toc-nav :active {
			color: #C00;
		}
	}

/** ToC Sidebar ***************************************************************/

	/* Floating sidebar */
	@media screen {
		body.toc-sidebar #toc {
			position: fixed;
			top: 0; bottom: 0;
			left: 0;
			width: 23.5em;
			max-width: 80%;
			max-width: calc(100% - 2em - 26px);
			overflow: auto;
			padding: 0 1em;
			padding-left: 42px;
			padding-left: calc(1em + 26px);
			background: inherit;
			background-color: #f7f8f9;
			z-index: 1;
			box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset;
		}
		body.toc-sidebar #toc h2 {
			margin-top: .8rem;
			font-variant: small-caps;
			font-variant: all-small-caps;
			text-transform: lowercase;
			font-weight: bold;
			color: gray;
			color: hsla(203,20%,40%,.7);
		}
		body.toc-sidebar #toc-jump:not(:focus) {
			width: 0;
			height: 0;
			padding: 0;
			position: absolute;
			overflow: hidden;
		}
	}
	/* Hide main scroller when only the ToC is visible anyway */
	@media screen and (max-width: 28em) {
		body.toc-sidebar {
			overflow: hidden;
		}
	}

	/* Sidebar with its own space */
	@media screen and (min-width: 78em) {
		body:not(.toc-inline) #toc {
			position: fixed;
			top: 0; bottom: 0;
			left: 0;
			width: 23.5em;
			overflow: auto;
			padding: 0 1em;
			padding-left: 42px;
			padding-left: calc(1em + 26px);
			background: inherit;
			background-color: #f7f8f9;
			z-index: 1;
			box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset;
		}
		body:not(.toc-inline) #toc h2 {
			margin-top: .8rem;
			font-variant: small-caps;
			font-variant: all-small-caps;
			text-transform: lowercase;
			font-weight: bold;
			color: gray;
			color: hsla(203,20%,40%,.7);
		}

		body:not(.toc-inline) {
			padding-left: 29em;
		}
		/* See also Overflow section at the bottom */

		body:not(.toc-inline) #toc-jump:not(:focus) {
			width: 0;
			height: 0;
			padding: 0;
			position: absolute;
			overflow: hidden;
		}
	}
	@media screen and (min-width: 90em) {
		body:not(.toc-inline) {
			margin: 0 4em;
		}
	}

/******************************************************************************/
/*                                Sectioning                                  */
/******************************************************************************/

/** Headings ******************************************************************/

	h1, h2, h3, h4, h5, h6, dt {
		page-break-after: avoid;
		page-break-inside: avoid;
		font: 100% sans-serif;   /* Reset all font styling to clear out UA styles */
		font-family: inherit;    /* Inherit the font family. */
		line-height: 1.2;        /* Keep wrapped headings compact */
		hyphens: manual;         /* Hyphenated headings look weird */
	}

	h2, h3, h4, h5, h6 {
		margin-top: 3rem;
	}

	h1, h2, h3 {
		color: #005A9C;
		background: transparent;
	}

	h1 { font-size: 170%; }
	h2 { font-size: 140%; }
	h3 { font-size: 120%; }
	h4 { font-weight: bold; }
	h5 { font-style: italic; }
	h6 { font-variant: small-caps; }
	dt { font-weight: bold; }

/** Subheadings ***************************************************************/

	h1 + h2,
	#subtitle {
		/* #subtitle is a subtitle in an H2 under the H1 */
		margin-top: 0;
	}
	h2 + h3,
	h3 + h4,
	h4 + h5,
	h5 + h6 {
		margin-top: 1.2em; /* = 1 x line-height */
	}

/** Section divider ***********************************************************/

	:not(.head) > hr {
		font-size: 1.5em;
		text-align: center;
		margin: 1em auto;
		height: auto;
		border: transparent solid 0;
		background: transparent;
	}
	:not(.head) > hr::before {
		content: "\2727\2003\2003\2727\2003\2003\2727";
	}

/******************************************************************************/
/*                            Paragraphs and Lists                            */
/******************************************************************************/

	p {
		margin: 1em 0;
	}

	dd > p:first-child,
	li > p:first-child {
		margin-top: 0;
	}

	ul, ol {
		margin-left: 0;
		padding-left: 2em;
	}

	li {
		margin: 0.25em 0 0.5em;
		padding: 0;
	}

	dl dd {
		margin: 0 0 .5em 2em;
	}

	.head dd + dd { /* compact for header */
		margin-top: -.5em;
	}

	/* Style for algorithms */
	ol.algorithm ol:not(.algorithm),
	.algorithm > ol ol:not(.algorithm) {
	 border-left: 0.5em solid #DEF;
	}

	/* Put nice boxes around each algorithm. */
	[data-algorithm]:not(.heading) {
	  padding: .5em;
	  border: thin solid #ddd; border-radius: .5em;
	  margin: .5em calc(-0.5em - 1px);
	}
	[data-algorithm]:not(.heading) > :first-child {
	  margin-top: 0;
	}
	[data-algorithm]:not(.heading) > :last-child {
	  margin-bottom: 0;
	}

	/* Style for switch/case <dl>s */
	dl.switch > dd > ol.only,
	dl.switch > dd > .only > ol {
	 margin-left: 0;
	}
	dl.switch > dd > ol.algorithm,
	dl.switch > dd > .algorithm > ol {
	 margin-left: -2em;
	}
	dl.switch {
	 padding-left: 2em;
	}
	dl.switch > dt {
	 text-indent: -1.5em;
	 margin-top: 1em;
	}
	dl.switch > dt + dt {
	 margin-top: 0;
	}
	dl.switch > dt::before {
	 content: '\21AA';
	 padding: 0 0.5em 0 0;
	 display: inline-block;
	 width: 1em;
	 text-align: right;
	 line-height: 0.5em;
	}

/** Terminology Markup ********************************************************/


/******************************************************************************/
/*                                 Inline Markup                              */
/******************************************************************************/

/** Terminology Markup ********************************************************/
	dfn   { /* Defining instance */
		font-weight: bolder;
	}
	a > i { /* Instance of term */
		font-style: normal;
	}
	dt dfn code, code.idl {
		font-size: medium;
	}
	dfn var {
		font-style: normal;
	}

/** Change Marking ************************************************************/

	del { color: red;  text-decoration: line-through; }
	ins { color: #080; text-decoration: underline;    }

/** Miscellaneous improvements to inline formatting ***************************/

	sup {
		vertical-align: super;
		font-size: 80%
	}

/******************************************************************************/
/*                                    Code                                    */
/******************************************************************************/

/** General monospace/pre rules ***********************************************/

	pre, code, samp {
		font-family: Menlo, Consolas, "DejaVu Sans Mono", Monaco, monospace;
		font-size: .9em;
		page-break-inside: avoid;
		hyphens: none;
		text-transform: none;
	}
	pre code,
	code code {
		font-size: 100%;
	}

	pre {
		margin-top: 1em;
		margin-bottom: 1em;
		overflow: auto;
	}

/** Inline Code fragments *****************************************************/

  /* Do something nice. */

/******************************************************************************/
/*                                    Links                                   */
/******************************************************************************/

/** General Hyperlinks ********************************************************/

	/* We hyperlink a lot, so make it less intrusive */
	a[href] {
		color: #034575;
		text-decoration: none;
		border-bottom: 1px solid #707070;
		/* Need a bit of extending for it to look okay */
		padding: 0 1px 0;
		margin: 0 -1px 0;
	}
	a:visited {
		border-bottom-color: #BBB;
	}

	/* Use distinguishing colors when user is interacting with the link */
	a[href]:focus,
	a[href]:hover {
		background: #f8f8f8;
		background: rgba(75%, 75%, 75%, .25);
		border-bottom-width: 3px;
		margin-bottom: -2px;
	}
	a[href]:active {
		color: #C00;
		border-color: #C00;
	}

	/* Backout above styling for W3C logo */
	.head .logo,
	.head .logo a {
		border: none;
		text-decoration: none;
		background: transparent;
	}

/******************************************************************************/
/*                                    Images                                  */
/******************************************************************************/

	img {
		border-style: none;
	}

	/* For autogen numbers, add
	   .caption::before, figcaption::before { content: "Figure " counter(figure) ". "; }
	*/

	figure, .figure, .sidefigure {
		page-break-inside: avoid;
		text-align: center;
		margin: 2.5em 0;
	}
	.figure img,    .sidefigure img,    figure img,
	.figure object, .sidefigure object, figure object {
		max-width: 100%;
		margin: auto;
	}
	.figure pre, .sidefigure pre, figure pre {
		text-align: left;
		display: table;
		margin: 1em auto;
	}
	.figure table, figure table {
		margin: auto;
	}
	@media screen and (min-width: 20em) {
		.sidefigure {
			float: right;
			width: 50%;
			margin: 0 0 0.5em 0.5em
		}
	}
	.caption, figcaption, caption {
		font-style: italic;
		font-size: 90%;
	}
	.caption::before, figcaption::before, figcaption > .marker {
		font-weight: bold;
	}
	.caption, figcaption {
		counter-increment: figure;
	}

	/* DL list is indented 2em, but figure inside it is not */
	dd > .figure, dd > figure { margin-left: -2em }

/******************************************************************************/
/*                             Colored Boxes                                  */
/******************************************************************************/

	.issue, .note, .example, .assertion, .advisement, blockquote {
		padding: .5em;
		border: .5em;
		border-left-style: solid;
		page-break-inside: avoid;
	}
	span.issue, span.note {
		padding: .1em .5em .15em;
		border-right-style: solid;
	}

	.issue,
	.note,
	.example,
	.advisement,
	.assertion,
	blockquote {
		margin: 1em auto;
	}
	.note  > p:first-child,
	.issue > p:first-child,
	blockquote > :first-child {
		margin-top: 0;
	}
	blockquote > :last-child {
		margin-bottom: 0;
	}

/** Blockquotes ***************************************************************/

	blockquote {
		border-color: silver;
	}

/** Open issue ****************************************************************/

	.issue {
		border-color: #E05252;
		background: #FBE9E9;
		counter-increment: issue;
		overflow: auto;
	}
	.issue::before, .issue > .marker {
		text-transform: uppercase;
		color: #AE1E1E;
		padding-right: 1em;
		text-transform: uppercase;
	}
	/* Add .issue::before { content: "Issue " counter(issue) " "; } for autogen numbers,
	   or use class="marker" to mark up the issue number in source. */

/** Example *******************************************************************/

	.example {
		border-color: #E0CB52;
		background: #FCFAEE;
		counter-increment: example;
		overflow: auto;
		clear: both;
	}
	.example::before, .example > .marker {
		text-transform: uppercase;
		color: #827017;
		min-width: 7.5em;
		display: block;
	}
	/* Add .example::before { content: "Example " counter(example) " "; } for autogen numbers,
	   or use class="marker" to mark up the example number in source. */

/** Non-normative Note ********************************************************/

	.note {
		border-color: #52E052;
		background: #E9FBE9;
		overflow: auto;
	}

	.note::before, .note > .marker,
	details.note > summary::before,
	details.note > summary > .marker {
		text-transform: uppercase;
		display: block;
		color: hsl(120, 70%, 30%);
	}
	/* Add .note::before { content: "Note"; } for autogen label,
	   or use class="marker" to mark up the label in source. */

	details.note > summary {
		display: block;
		color: hsl(120, 70%, 30%);
	}
	details.note[open] > summary {
		border-bottom: 1px silver solid;
	}

/** Assertion Box *************************************************************/
	/*  for assertions in algorithms */

	.assertion {
		border-color: #AAA;
		background: #EEE;
	}

/** Advisement Box ************************************************************/
	/*  for attention-grabbing normative statements */

	.advisement {
		border-color: orange;
		border-style: none solid;
		background: #FFEECC;
	}
	strong.advisement {
		display: block;
		text-align: center;
	}
	.advisement > .marker {
		color: #B35F00;
	}

/** Spec Obsoletion Notice ****************************************************/
	/* obnoxious obsoletion notice for older/abandoned specs. */

	details {
		display: block;
	}
	summary {
		font-weight: bolder;
	}

	.annoying-warning:not(details),
	details.annoying-warning:not([open]) > summary,
	details.annoying-warning[open] {
		background: #fdd;
		color: red;
		font-weight: bold;
		padding: .75em 1em;
		border: thick red;
		border-style: solid;
		border-radius: 1em;
	}
	.annoying-warning :last-child {
		margin-bottom: 0;
	}

@media not print {
	details.annoying-warning[open] {
		position: fixed;
		left: 1em;
		right: 1em;
		bottom: 1em;
		z-index: 1000;
	}
}

	details.annoying-warning:not([open]) > summary {
		text-align: center;
	}

/** Entity Definition Boxes ***************************************************/

	.def {
		padding: .5em 1em;
		background: #DEF;
		margin: 1.2em 0;
		border-left: 0.5em solid #8CCBF2;
	}

/******************************************************************************/
/*                                    Tables                                  */
/******************************************************************************/

	th, td {
		text-align: left;
		text-align: start;
	}

/** Property/Descriptor Definition Tables *************************************/

	table.def {
		/* inherits .def box styling, see above */
		width: 100%;
		border-spacing: 0;
	}

	table.def td,
	table.def th {
		padding: 0.5em;
		vertical-align: baseline;
		border-bottom: 1px solid #bbd7e9;
	}

	table.def > tbody > tr:last-child th,
	table.def > tbody > tr:last-child td {
		border-bottom: 0;
	}

	table.def th {
		font-style: italic;
		font-weight: normal;
		padding-left: 1em;
		width: 3em;
	}

	/* For when values are extra-complex and need formatting for readability */
	table td.pre {
		white-space: pre-wrap;
	}

	/* A footnote at the bottom of a def table */
	table.def           td.footnote {
		padding-top: 0.6em;
	}
	table.def           td.footnote::before {
		content: " ";
		display: block;
		height: 0.6em;
		width: 4em;
		border-top: thin solid;
	}

/** Data tables (and properly marked-up index tables) *************************/
	/*
		 <table class="data"> highlights structural relationships in a table
		 when correct markup is used (e.g. thead/tbody, th vs. td, scope attribute)

		 Use class="complex data" for particularly complicated tables --
		 (This will draw more lines: busier, but clearer.)

		 Use class="long" on table cells with paragraph-like contents
		 (This will adjust text alignment accordingly.)
		 Alternately use class="longlastcol" on tables, to have the last column assume "long".
	*/

	table {
		word-wrap: normal;
		overflow-wrap: normal;
		hyphens: manual;
	}

	table.data,
	table.index {
		margin: 1em auto;
		border-collapse: collapse;
		border: hidden;
		width: 100%;
	}
	table.data caption,
	table.index caption {
		max-width: 50em;
		margin: 0 auto 1em;
	}

	table.data td,  table.data th,
	table.index td, table.index th {
		padding: 0.5em 1em;
		border-width: 1px;
		border-color: silver;
		border-top-style: solid;
	}

	table.data thead td:empty {
		padding: 0;
		border: 0;
	}

	table.data  thead,
	table.index thead,
	table.data  tbody,
	table.index tbody {
		border-bottom: 2px solid;
	}

	table.data colgroup,
	table.index colgroup {
		border-left: 2px solid;
	}

	table.data  tbody th:first-child,
	table.index tbody th:first-child  {
		border-right: 2px solid;
		border-top: 1px solid silver;
		padding-right: 1em;
	}

	table.data th[colspan],
	table.data td[colspan] {
		text-align: center;
	}

	table.complex.data th,
	table.complex.data td {
		border: 1px solid silver;
		text-align: center;
	}

	table.data.longlastcol td:last-child,
	table.data td.long {
	 vertical-align: baseline;
	 text-align: left;
	}

	table.data img {
		vertical-align: middle;
	}


/*
Alternate table alignment rules

	table.data,
	table.index {
		text-align: center;
	}

	table.data  thead th[scope="row"],
	table.index thead th[scope="row"] {
		text-align: right;
	}

	table.data  tbody th:first-child,
	table.index tbody th:first-child  {
		text-align: right;
	}

Possible extra rowspan handling

	table.data  tbody th[rowspan]:not([rowspan='1']),
	table.index tbody th[rowspan]:not([rowspan='1']),
	table.data  tbody td[rowspan]:not([rowspan='1']),
	table.index tbody td[rowspan]:not([rowspan='1']) {
		border-left: 1px solid silver;
	}

	table.data  tbody th[rowspan]:first-child,
	table.index tbody th[rowspan]:first-child,
	table.data  tbody td[rowspan]:first-child,
	table.index tbody td[rowspan]:first-child{
		border-left: 0;
		border-right: 1px solid silver;
	}
*/

/******************************************************************************/
/*                                  Indices                                   */
/******************************************************************************/


/** Table of Contents *********************************************************/

	.toc a {
		/* More spacing; use padding to make it part of the click target. */
		padding-top: 0.1rem;
		/* Larger, more consistently-sized click target */
		display: block;
		/* Reverse color scheme */
		color: black;
		border-color: #3980B5;
		border-bottom-width: 3px !important;
		margin-bottom: 0px !important;
	}
	.toc a:visited {
		border-color: #054572;
	}
	.toc a:not(:focus):not(:hover) {
		/* Allow colors to cascade through from link styling */
		border-bottom-color: transparent;
	}

	.toc, .toc ol, .toc ul, .toc li {
		list-style: none; /* Numbers must be inlined into source */
		/* because generated content isn't search/selectable and markers can't do multilevel yet */
		margin:  0;
		padding: 0;
		line-height: 1.1rem; /* consistent spacing */
	}

	/* ToC not indented until third level, but font style & margins show hierarchy */
	.toc > li             { font-weight: bold;   }
	.toc > li li          { font-weight: normal; }
	.toc > li li li       { font-size:   95%;    }
	.toc > li li li li    { font-size:   90%;    }
	.toc > li li li li .secno { font-size: 85%; }
	.toc > li li li li li { font-size:   85%;    }
	.toc > li li li li li .secno { font-size: 100%; }

	/* @supports not (display:grid) { */
		.toc > li             { margin: 1.5rem 0;    }
		.toc > li li          { margin: 0.3rem 0;    }
		.toc > li li li       { margin-left: 2rem;   }

		/* Section numbers in a column of their own */
		.toc .secno {
			float: left;
			width: 4rem;
			white-space: nowrap;
		}

		.toc li {
			clear: both;
		}

		:not(li) > .toc              { margin-left:  5rem; }
		.toc .secno                  { margin-left: -5rem; }
		.toc > li li li .secno       { margin-left: -7rem; }
		.toc > li li li li .secno    { margin-left: -9rem; }
		.toc > li li li li li .secno { margin-left: -11rem; }

		/* Tighten up indentation in narrow ToCs */
		@media (max-width: 30em) {
			:not(li) > .toc              { margin-left:  4rem; }
			.toc .secno                  { margin-left: -4rem; }
			.toc > li li li              { margin-left:  1rem; }
			.toc > li li li .secno       { margin-left: -5rem; }
			.toc > li li li li .secno    { margin-left: -6rem; }
			.toc > li li li li li .secno { margin-left: -7rem; }
		}
	/* } */

	@supports (display:grid) and (display:contents) {
		/* Use #toc over .toc to override non-@supports rules. */
		#toc {
			display: grid;
			align-content: start;
			grid-template-columns: auto 1fr;
			grid-column-gap: 1rem;
			column-gap: 1rem;
			grid-row-gap: .6rem;
			row-gap: .6rem;
		}
		#toc h2 {
			grid-column: 1 / -1;
			margin-bottom: 0;
		}
		#toc ol,
		#toc li,
		#toc a {
			display: contents;
			/* Switch <a> to subgrid when supported */
		}
		#toc span {
			margin: 0;
		}
		#toc > .toc > li > a > span {
			/* The spans of the top-level list,
			   comprising the first items of each top-level section. */
			margin-top: 1.1rem;
		}
		#toc#toc .secno { /* Ugh, need more specificity to override base.css */
			grid-column: 1;
			width: auto;
			margin-left: 0;
		}
		#toc .content {
			grid-column: 2;
			width: auto;
			margin-right: 1rem;
		}
		#toc .content:hover {
			background: rgba(75%, 75%, 75%, .25);
			border-bottom: 3px solid #054572;
			margin-bottom: -3px;
		}
		#toc li li li .content {
			margin-left: 1rem;
		}
		#toc li li li li .content {
			margin-left: 2rem;
		}
	}


/** Index *********************************************************************/

	/* Index Lists: Layout */
	ul.index       { margin-left: 0; columns: 15em; text-indent: 1em hanging; }
	ul.index li    { margin-left: 0; list-style: none; break-inside: avoid; }
	ul.index li li { margin-left: 1em }
	ul.index dl    { margin-top: 0; }
	ul.index dt    { margin: .2em 0 .2em 20px;}
	ul.index dd    { margin: .2em 0 .2em 40px;}
	/* Index Lists: Typography */
	ul.index ul,
	ul.index dl { font-size: smaller; }
	@media not print {
		ul.index li span {
			white-space: nowrap;
			color: transparent; }
		ul.index li a:hover + span,
		ul.index li a:focus + span {
			color: #707070;
		}
	}

/** Index Tables *****************************************************/
	/* See also the data table styling section, which this effectively subclasses */

	table.index {
		font-size: small;
		border-collapse: collapse;
		border-spacing: 0;
		text-align: left;
		margin: 1em 0;
	}

	table.index td,
	table.index th {
		padding: 0.4em;
	}

	table.index tr:hover td:not([rowspan]),
	table.index tr:hover th:not([rowspan]) {
		background: #f7f8f9;
	}

	/* The link in the first column in the property table (formerly a TD) */
	table.index th:first-child a {
		font-weight: bold;
	}

/******************************************************************************/
/*                                    Print                                   */
/******************************************************************************/

	@media print {
		/* Pages have their own margins. */
		html {
			margin: 0;
		}
		/* Serif for print. */
		body {
			font-family: serif;
		}
	}
	@page {
		margin: 1.5cm 1.1cm;
	}

/******************************************************************************/
/*                                    Legacy                                  */
/******************************************************************************/

	/* This rule is inherited from past style sheets. No idea what it's for. */
	.hide { display: none }



/******************************************************************************/
/*                             Overflow Control                               */
/******************************************************************************/

	.figure .caption, .sidefigure .caption, figcaption {
		/* in case figure is overlarge, limit caption to 50em */
		max-width: 50rem;
		margin-left: auto;
		margin-right: auto;
	}
	.overlarge {
		/* Magic to create good table positioning:
		   "content column" is 50ems wide at max; less on smaller screens.
		   Extra space (after ToC + content) is empty on the right.

		   1. When table < content column, centers table in column.
		   2. When content < table < available, left-aligns.
		   3. When table > available, fills available + scroll bar.
		*/ 
		display: grid;
		grid-template-columns: minmax(0, 50em);
	}
	.overlarge > table {
		/* limit preferred width of table */
		max-width: 50em;
		margin-left: auto;
		margin-right: auto;
	}

	@media (min-width: 55em) {
		.overlarge {
			margin-right: calc(13px + 26.5rem - 50vw);
			max-width: none;
		}
	}
	@media screen and (min-width: 78em) {
		body:not(.toc-inline) .overlarge {
			/* 30.5em body padding 50em content area */
			margin-right: calc(40em - 50vw) !important;
		}
	}
	@media screen and (min-width: 90em) {
		body:not(.toc-inline) .overlarge {
			/* 4em html margin 30.5em body padding 50em content area */
			margin-right: calc(84.5em - 100vw) !important;
		}
	}

	@media not print {
		.overlarge {
			overflow-x: auto;
			/* See Lea Verou's explanation background-attachment:
			 * http://lea.verou.me/2012/04/background-attachment-local/
			 *
			background: top left  / 4em 100% linear-gradient(to right,  #ffffff, rgba(255, 255, 255, 0)) local,
			            top right / 4em 100% linear-gradient(to left, #ffffff, rgba(255, 255, 255, 0)) local,
			            top left  / 1em 100% linear-gradient(to right,  #c3c3c5, rgba(195, 195, 197, 0)) scroll,
			            top right / 1em 100% linear-gradient(to left, #c3c3c5, rgba(195, 195, 197, 0)) scroll,
			            white;
			background-repeat: no-repeat;
			*/
		}
	}
</style>
  <link href="https://www.w3.org/StyleSheets/TR/2016/cg-draft" rel="stylesheet">
  <link href="https://webbluetoothcg.github.io/web-bluetooth/scanning.html" rel="canonical">
<style>
  .argument-list { display: inline-block; vertical-align: top; }
  /* Show self-links for various elements. This is incompatible with nearby floats. */
  .note, .why, .example, .issue { overflow: inherit; }
</style>
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: gray;
    color: white;
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: black;
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }</style>
<style>/* style-counters */

body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}</style>
<style>/* style-var-click-highlighting */

    var { cursor: pointer; }
    var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; }
    var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; }
    var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; }
    var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; }
    var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; }
    var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; }
    var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; }
    </style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
    color: #005a9c;
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}</style>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"></p>
   <h1 class="p-name no-ref" id="title">Web Bluetooth Scanning</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Draft Community Group Report, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>This version:
     <dd><a class="u-url" href="https://webbluetoothcg.github.io/web-bluetooth/scanning.html">https://webbluetoothcg.github.io/web-bluetooth/scanning.html</a>
     <dt class="editor">Editor:
     <dd class="editor p-author h-card vcard"><a class="p-name fn u-url url" href="https://github.com/WebBluetoothCG/web-bluetooth/graphs/contributors">See contributors on GitHub</a>
     <dt>Participate:
     <dd><a href="https://www.w3.org/community/web-bluetooth/">Join the W3C Community Group</a>
     <dd><a href="https://github.com/WebBluetoothCG/web-bluetooth">Fix the text through GitHub</a>
     <dd><a href="mailto:public-web-bluetooth@w3.org">public-web-bluetooth@w3.org</a> (<a href="https://lists.w3.org/Archives/Public/public-web-bluetooth/" rel="discussion">archives</a>)
     <dd><a href="irc://irc.w3.org:6665/#web-bluetooth">IRC: #web-bluetooth on W3C’s IRC</a>
     <dd>
    </dl>
   </div>
   <div data-fill-with="warning"></div>
   <p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1970 the Contributors to the Web Bluetooth Specification, published by the <a href="https://www.w3.org/community/web-bluetooth/">Web Bluetooth Community Group</a> under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a>.
A human-readable <a href="http://www.w3.org/community/about/agreements/cla-deed/">summary</a> is available. </p>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>This document describes an API to scan for nearby Bluetooth Low Energy devices in real time.</p>
  </div>
  <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
  <div data-fill-with="status">
   <p> This specification was published by the <a href="https://www.w3.org/community/web-bluetooth/">Web Bluetooth Community Group</a>.
  It is not a W3C Standard nor is it on the W3C Standards Track.

  Please note that under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a> there is a limited opt-out and other conditions apply.

  Learn more about <a href="http://www.w3.org/community/">W3C Community and Business Groups</a>. </p>
   <p> Changes to this document may be tracked at <a href="https://github.com/WebBluetoothCG/web-bluetooth/commits/gh-pages">https://github.com/WebBluetoothCG/web-bluetooth/commits/gh-pages</a>. </p>
   <p>If you wish to make comments regarding this document, please send them to <a href="mailto:public-web-bluetooth@w3.org">public-web-bluetooth@w3.org</a> (<a href="mailto:public-web-bluetooth-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-web-bluetooth/">archives</a>).</p>
   <p></p>
  </div>
  <div data-fill-with="at-risk"></div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li>
     <a href="#introduction"><span class="secno">1</span> <span class="content">Introduction</span></a>
     <ol class="toc">
      <li><a href="#introduction-examples"><span class="secno">1.1</span> <span class="content">Examples</span></a>
     </ol>
    <li><a href="#privacy"><span class="secno">2</span> <span class="content">Privacy considerations</span></a>
    <li><a href="#security"><span class="secno">3</span> <span class="content">Security considerations</span></a>
    <li>
     <a href="#scanning"><span class="secno">4</span> <span class="content">Scanning for BLE advertisements</span></a>
     <ol class="toc">
      <li><a href="#scan-control"><span class="secno">4.1</span> <span class="content">Controlling a BLE scan</span></a>
      <li><a href="#permission"><span class="secno">4.2</span> <span class="content">Permission to scan</span></a>
     </ol>
    <li>
     <a href="#events"><span class="secno">5</span> <span class="content">Event handling</span></a>
     <ol class="toc">
      <li><a href="#advertising-events"><span class="secno">5.1</span> <span class="content">Responding to advertising events</span></a>
     </ol>
    <li><a href="#changes"><span class="secno">6</span> <span class="content">Changes to existing interfaces</span></a>
    <li><a href="#terminology"><span class="secno">7</span> <span class="content">Terminology and conventions</span></a>
    <li><a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
    <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
   </ol>
  </nav>
  <main>
   <section class="non-normative">
    <h2 class="heading settled" data-level="1" id="introduction"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#introduction"></a></h2>
    <p><em>This section is non-normative.</em></p>
    <p> <a href="https://www.bluetooth.com/what-is-bluetooth-technology/bluetooth-technology-basics/low-energy">Bluetooth Low Energy (BLE)</a> allows devices to broadcast advertisements to nearby <a data-link-type="dfn" href="#observer" id="ref-for-observer">observers</a>.
    These advertisements can contain small amounts of data
    of a variety of types defined in <a data-link-type="biblio" href="#biblio-bluetooth-supplement6">[BLUETOOTH-SUPPLEMENT6]</a>. </p>
    <p> For example, a beacon might announce that it’s next to a particular museum exhibit
    and is advertising with 1mW of power,
    which would let nearby observers know their approximate distance to that exhibit. </p>
    <p> This specification extends <a data-link-type="biblio" href="#biblio-web-bluetooth">[web-bluetooth]</a> to allow websites to
    receive these advertisements from nearby BLE devices,
    with the user’s permission. </p>
    <section>
     <h3 class="heading settled" data-level="1.1" id="introduction-examples"><span class="secno">1.1. </span><span class="content">Examples</span><a class="self-link" href="#introduction-examples"></a></h3>
     <div class="example" id="example-ibeacon">
      <a class="self-link" href="#example-ibeacon"></a> 
      <p> To discover what iBeacons are nearby and measure their distance,
        a website could use code like the following: </p>
<pre class="highlight"><c- a>function</c-> recordNearbyBeacon<c- p>(</c->major<c- p>,</c-> minor<c- p>,</c-> pathLossVs1m<c- p>)</c-> <c- p>{</c-> <c- p>...</c-> <c- p>}</c->
navigator<c- p>.</c->bluetooth<c- p>.</c-><a data-link-type="idl" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan">requestLEScan</a><c- p>({</c->
  filters<c- o>:</c-> <c- p>[{</c->manufacturerData<c- o>:</c-> <c- p>{</c-><c- mh>0x004C</c-><c- o>:</c-> <c- p>{</c->dataPrefix<c- o>:</c-> <c- k>new</c-> Uint8Array<c- p>([</c->
    <c- mh>0x02</c-><c- p>,</c-> <c- mh>0x15</c-><c- p>,</c-> <c- c1>// iBeacon identifier.</c->
    <c- mi>0</c-><c- p>,</c-> <c- mi>1</c-><c- p>,</c-> <c- mi>2</c-><c- p>,</c-> <c- mi>3</c-><c- p>,</c-> <c- mi>4</c-><c- p>,</c-> <c- mi>5</c-><c- p>,</c-> <c- mi>6</c-><c- p>,</c-> <c- mi>7</c-><c- p>,</c-> <c- mi>8</c-><c- p>,</c-> <c- mi>9</c-><c- p>,</c-> <c- mi>10</c-><c- p>,</c-> <c- mi>11</c-><c- p>,</c-> <c- mi>12</c-><c- p>,</c-> <c- mi>13</c-><c- p>,</c-> <c- mi>14</c-><c- p>,</c-> <c- mi>15</c->  <c- c1>// My beacon UUID.</c->
  <c- p>])}}}],</c->
  keepRepeatedDevices<c- o>:</c-> <c- kc>true</c->
<c- p>}).</c->then<c- p>(()</c-> <c- p>=></c-> <c- p>{</c->
  navigator<c- p>.</c->bluetooth<c- p>.</c->addEventListener<c- p>(</c-><c- t>'</c-><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#eventdef-bluetoothdevice-advertisementreceived" id="ref-for-eventdef-bluetoothdevice-advertisementreceived"><c- t>advertisementreceived</c-></a><c- t>'</c-><c- p>,</c-> event <c- p>=></c-> <c- p>{</c->
    <c- a>let</c-> appleData <c- o>=</c-> event<c- p>.</c->manufacturerData<c- p>.</c->get<c- p>(</c-><a href="https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers" title="Apple, Inc.&apos;s Company Identifier"><c- mh>0x004C</c-></a><c- p>);</c->
    <c- k>if</c-> <c- p>(</c->appleData<c- p>.</c->byteLength <c- o>!=</c-> <c- mi>23</c-><c- p>)</c-> <c- p>{</c->
      <c- c1>// Isn’t an iBeacon.</c->
      <c- k>return</c-><c- p>;</c->
    <c- p>}</c->
    <c- a>let</c-> major <c- o>=</c-> appleData<c- p>.</c->getUint16<c- p>(</c-><c- mi>18</c-><c- p>,</c-> <c- kc>false</c-><c- p>);</c->
    <c- a>let</c-> minor <c- o>=</c-> appleData<c- p>.</c->getUint16<c- p>(</c-><c- mi>20</c-><c- p>,</c-> <c- kc>false</c-><c- p>);</c->
    <c- a>let</c-> txPowerAt1m <c- o>=</c-> <c- o>-</c->appleData<c- p>.</c->getInt8<c- p>(</c-><c- mi>22</c-><c- p>);</c->
    <c- a>let</c-> pathLossVs1m <c- o>=</c-> txPowerAt1m <c- o>-</c-> event<c- p>.</c->rssi<c- p>;</c->

    recordNearbyBeacon<c- p>(</c->major<c- p>,</c-> minor<c- p>,</c-> pathLossVs1m<c- p>);</c->
  <c- p>});</c->
<c- p>})</c->
</pre>
     </div>
    </section>
   </section>
   <section class="non-normative">
    <h2 class="heading settled" data-level="2" id="privacy"><span class="secno">2. </span><span class="content">Privacy considerations</span><a class="self-link" href="#privacy"></a></h2>
    <p><em>This section is non-normative.</em></p>
    <p> <a data-link-type="dfn" href="#active-scanning" id="ref-for-active-scanning">Actively scanning</a> for advertisements
    broadcasts a <a data-link-type="dfn" href="#device-address" id="ref-for-device-address">device address</a> of the scanning device.
    If the UA’s Bluetooth system supports the <a data-link-type="dfn" href="#privacy-feature" id="ref-for-privacy-feature">privacy feature</a>,
    this address rotates periodically,
    which prevents remote radios from tracking the user’s device.
    However, if the UA’s Bluetooth system does not support the <a data-link-type="dfn" href="#privacy-feature" id="ref-for-privacy-feature①">privacy feature</a>,
    this address is a stable unique identifier that’s difficult to change.
    To mitigate this, UAs should either use <a data-link-type="dfn" href="#passive-scanning" id="ref-for-passive-scanning">passive scanning</a>,
    use the <a data-link-type="dfn" href="#privacy-feature-in-an-observer" id="ref-for-privacy-feature-in-an-observer">privacy feature in an observer</a>,
    or warn the user that nearby devices will learn the identity of their device. </p>
    <p> The ambient advertisements in a user’s area are unlikely to directly include GPS coordinates,
    but are likely to contain unique identifiers
    that could be manually correlated with particular physical locations
    or with particular other people.
    Given that, the user needs to give permission
    before a website gets access to nearby advertisements. </p>
    <p> If a user has already given a site permission to know their location,
    it might be ok to implicitly grant access to BLE advertisements.
    However, BLE advertisements give away
    strictly less location information than full <a data-link-type="biblio" href="#biblio-geolocation-api">[geolocation-api]</a> access,
    so UAs should allow users to grant that intermediate level of access. </p>
    <p> BLE advertisements are usually fully public,
    since they’re broadcast unencrypted on 2.4GHz radio waves.
    However, it’s possible that a user would
    have a device broadcast private information in a radio-shielded room.
    This is probably an inappropriate use for BLE advertisements,
    but might argue for requiring explicit permission to scan,
    rather than inferring it from having permission to get a geolocation. </p>
   </section>
   <section class="non-normative">
    <h2 class="heading settled" data-level="3" id="security"><span class="secno">3. </span><span class="content">Security considerations</span><a class="self-link" href="#security"></a></h2>
    <p><em>This section is non-normative.</em></p>
    <p> Because this API doesn’t write anything,
    there are few if any security implications.
    A device in a shielded room might broadcast security-sensitive information,
    but we don’t have any actual attack scenarios for that. </p>
   </section>
   <section>
    <h2 class="heading settled" data-level="4" id="scanning"><span class="secno">4. </span><span class="content">Scanning for BLE advertisements</span><a class="self-link" href="#scanning"></a></h2>
<pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-bluetoothlescanoptions"><code><c- g>BluetoothLEScanOptions</c-></code></dfn> {
  <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit"><c- n>BluetoothLEScanFilterInit</c-></a>> <dfn class="idl-code" data-dfn-for="BluetoothLEScanOptions" data-dfn-type="dict-member" data-export data-type="sequence<BluetoothLEScanFilterInit> " id="dom-bluetoothlescanoptions-filters"><code><c- g>filters</c-></code><a class="self-link" href="#dom-bluetoothlescanoptions-filters"></a></dfn>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-default="false" data-link-type="dict-member" data-type="boolean " href="#dom-bluetoothlescanoptions-keeprepeateddevices" id="ref-for-dom-bluetoothlescanoptions-keeprepeateddevices"><c- g>keepRepeatedDevices</c-></a> = <c- b>false</c->;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <a class="idl-code" data-default="false" data-link-type="dict-member" data-type="boolean " href="#dom-bluetoothlescanoptions-acceptalladvertisements" id="ref-for-dom-bluetoothlescanoptions-acceptalladvertisements"><c- g>acceptAllAdvertisements</c-></a> = <c- b>false</c->;
};

<c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth" id="ref-for-bluetooth"><c- g>Bluetooth</c-></a> {
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext"><c- g>SecureContext</c-></a>]
  <c- b>Promise</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescan" id="ref-for-bluetoothlescan"><c- n>BluetoothLEScan</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan①"><c- g>requestLEScan</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dictdef-bluetoothlescanoptions" id="ref-for-dictdef-bluetoothlescanoptions"><c- n>BluetoothLEScanOptions</c-></a> <dfn class="idl-code" data-dfn-for="Bluetooth/requestLEScan(options), Bluetooth/requestLEScan()" data-dfn-type="argument" data-export id="dom-bluetooth-requestlescan-options-options"><code><c- g>options</c-></code><a class="self-link" href="#dom-bluetooth-requestlescan-options-options"></a></dfn>);
};
</pre>
    <div class="note no-marker" role="note">
     <div class="marker">NOTE: <code class="idl"><a data-link-type="idl" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan②">requestLEScan()</a></code> summary</div>
     <p> <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan③">requestLEScan(options)</a></code></code> starts scanning for BLE advertisements,
      asking the user for permission if they haven’t yet granted it. </p>
     <p> Because this could show a prompt,
      it requires a <a data-link-type="dfn" href="https://w3c.github.io/webappsec-secure-contexts/#secure-contexts" id="ref-for-secure-contexts">secure context</a>,
      and UAs are likely to require a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation" id="ref-for-triggered-by-user-activation">user gesture</a>. </p>
     <p> Advertising events that <a data-link-type="dfn" href="#bluetoothlescanfilter-match" id="ref-for-bluetoothlescanfilter-match">match</a> a <code class="idl"><a data-link-type="idl" href="#bluetoothlescanfilter" id="ref-for-bluetoothlescanfilter">BluetoothLEScanFilter</a></code> in an active <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan①">BluetoothLEScan</a></code> cause <code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#eventdef-bluetoothdevice-advertisementreceived" id="ref-for-eventdef-bluetoothdevice-advertisementreceived①">advertisementreceived</a></code> events to be dispatched
      to the sending <code class="idl"><a data-link-type="idl" href="index.html#bluetoothdevice" id="ref-for-bluetoothdevice">BluetoothDevice</a></code>.
      A filter matches if the advertisement includes data equal to each <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-present" id="ref-for-dfn-present">present</a> member.
      Usually, you’ll only include one member in each filter. </p>
     <p> Normally scans will discard
      the second and subsequent advertisements from a single device
      to save power.
      If you need to receive them,
      set <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanOptions" data-dfn-type="dict-member" data-export id="dom-bluetoothlescanoptions-keeprepeateddevices"><code>keepRepeatedDevices</code></dfn> to <code>true</code>.
      Note that setting <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanoptions-keeprepeateddevices" id="ref-for-dom-bluetoothlescanoptions-keeprepeateddevices①">keepRepeatedDevices</a></code> to <code>false</code> doesn’t guarantee you won’t get redundant events;
      it just allows the UA to save power by omitting them. </p>
     <p> In the rare case that you want to receive every advertisement without filtering them,
      use the <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanOptions" data-dfn-type="dict-member" data-export id="dom-bluetoothlescanoptions-acceptalladvertisements"><code>acceptAllAdvertisements</code></dfn> field. </p>
    </div>
    <div class="algorithm" data-algorithm="requestLEScan(options)">
     <p> The <code><dfn class="dfn-paneled idl-code" data-dfn-for="Bluetooth" data-dfn-type="method" data-export data-lt="requestLEScan(options)|requestLEScan()" id="dom-bluetooth-requestlescan"><code>requestLEScan(<var>options</var>)</code></dfn></code> method,
      when invoked, MUST return <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide/#a-new-promise" id="ref-for-a-new-promise">a new promise</a> <var>promise</var> and run the following steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">in parallel</a>: </p>
     <ol class="algorithm">
      <li>
        If <code><var>options</var>.acceptAllAdvertisements</code> is <code>true</code>,
        and <code><var>options</var>.filters</code> is present, <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise" id="ref-for-reject-promise">reject</a> <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror">TypeError</a></code> and abort these steps. 
       <p class="note" role="note"><span>Note:</span> There’s no need to include filters if all advertisements are being accepted.</p>
      <li>
        If <code><var>options</var>.acceptAllAdvertisements</code> is <code>false</code>,
        and <code><var>options</var>.filters</code> is either absent or empty, <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise" id="ref-for-reject-promise①">reject</a> <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①">TypeError</a></code> and abort these steps. 
       <p class="note" role="note"><span>Note:</span> An empty set of filters wouldn’t return any advertisements.</p>
      <li> Let <var>filters</var> be <code><var>options</var>.filters.map(filter=>new <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter" id="ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter">BluetoothLEScanFilter</a></code>(filter))</code>.
        If this throws an exception, <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise" id="ref-for-reject-promise②">reject</a> <var>promise</var> with that exception and abort these steps. 
      <li id="scanning-permission">
       <a class="self-link" href="#scanning-permission"></a> <a data-link-type="dfn" href="https://w3c.github.io/permissions/#request-permission-to-use" id="ref-for-request-permission-to-use">Request permission to use</a> 
<pre class="highlight"><c- p>{</c->
  name<c- o>:</c-> <a data-link-type="idl" href="#dom-permissionname-bluetooth-le-scan" id="ref-for-dom-permissionname-bluetooth-le-scan"><c- u>"bluetooth-le-scan"</c-></a><c- p>,</c->
  filters<c- o>:</c-> <var>options</var><c- p>.</c->filters<c- p>,</c->
  keepRepeatedDevices<c- o>:</c-> <var>options</var><c- p>.</c->keepRepeatedDevices<c- p>,</c->
  acceptAllAdvertisements<c- o>:</c-> <var>options</var><c- p>.</c->acceptAllAdvertisements<c- p>,</c->
<c- p>}</c->
</pre>
       <p class="note" role="note"><span>Note:</span> This may require that this algorithm was <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation" id="ref-for-triggered-by-user-activation①">triggered by user activation</a>.</p>
      <li> If the result is <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstate-denied" id="ref-for-dom-permissionstate-denied">"denied"</a></code>,
        reject <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notallowederror" id="ref-for-notallowederror">NotAllowedError</a></code> and abort these steps. 
      <li>
        Let <var>scan</var> be a new <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan②">BluetoothLEScan</a></code> instance
        whose fields are initialized as in the following table: 
       <table class="data">
        <thead>
         <tr>
          <th>Field
          <th>Initial value
        <tbody>
         <tr>
          <td><code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-filters" id="ref-for-dom-bluetoothlescan-filters">filters</a></code>
          <td><var>filters</var>
         <tr>
          <td><code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-keeprepeateddevices" id="ref-for-dom-bluetoothlescan-keeprepeateddevices">keepRepeatedDevices</a></code>
          <td><code><var>options</var>.keepRepeatedDevices</code>
         <tr>
          <td><code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-acceptalladvertisements" id="ref-for-dom-bluetoothlescan-acceptalladvertisements">acceptAllAdvertisements</a></code>
          <td><code><var>options</var>.acceptAllAdvertisements</code>
         <tr>
          <td><code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-active" id="ref-for-dom-bluetoothlescan-active">active</a></code>
          <td><code>true</code>
       </table>
      <li> Add <var>scan</var> to <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot">[[activeScans]]</a></code></code>. 
      <li>
        Ensure the UA is scanning for BLE advertisements
        in a mode that will receive at least
        all advertisements <a data-link-type="dfn" href="#bluetoothlescan-match" id="ref-for-bluetoothlescan-match">matching</a> any scan
        in any <code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot①">[[activeScans]]</a></code> set in the whole UA. 
       <p class="issue" id="issue-limit-scan-periods"><a class="self-link" href="#issue-limit-scan-periods"></a> Find wording that allows the UA to limit its scan to only certain periods of time,
          to save power. </p>
      <li>
        If the UA fails to start scanning,
        remove <var>scan</var> from <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot②">[[activeScans]]</a></code></code>, <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise" id="ref-for-reject-promise③">reject</a> <var>promise</var> with one of the following errors,
        and abort these steps: 
       <dl class="switch">
        <dt>The UA doesn’t support scanning for advertisements
        <dd><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notsupportederror" id="ref-for-notsupportederror">NotSupportedError</a></code>
        <dt>Bluetooth is turned off
        <dd><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#invalidstateerror" id="ref-for-invalidstateerror">InvalidStateError</a></code>
        <dt>Other reasons
        <dd><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#unknownerror" id="ref-for-unknownerror">UnknownError</a></code>
       </dl>
      <li> <a data-link-type="dfn">Resolve</a> <var>promise</var> with <var>scan</var>. 
     </ol>
    </div>
    <section>
     <h3 class="heading settled" data-level="4.1" id="scan-control"><span class="secno">4.1. </span><span class="content">Controlling a BLE scan</span><a class="self-link" href="#scan-control"></a></h3>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothdatafilter-bluetoothdatafilter" id="ref-for-dom-bluetoothdatafilter-bluetoothdatafilter"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothdatafilterinit" id="ref-for-dictdef-bluetoothdatafilterinit"><c- n>BluetoothDataFilterInit</c-></a> <dfn class="idl-code" data-dfn-for="BluetoothDataFilter/BluetoothDataFilter(init)" data-dfn-type="argument" data-export id="dom-bluetoothdatafilter-bluetoothdatafilter-init-init"><code><c- g>init</c-></code><a class="self-link" href="#dom-bluetoothdatafilter-bluetoothdatafilter-init-init"></a></dfn>)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothdatafilter"><code><c- g>BluetoothDataFilter</c-></code></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer"><c- b>ArrayBuffer</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothDataFilter" data-dfn-type="attribute" data-export data-readonly data-type="ArrayBuffer" id="dom-bluetoothdatafilter-dataprefix"><code><c- g>dataPrefix</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer①"><c- b>ArrayBuffer</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothDataFilter" data-dfn-type="attribute" data-export data-readonly data-type="ArrayBuffer" id="dom-bluetoothdatafilter-mask"><code><c- g>mask</c-></code></dfn>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter" id="ref-for-dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-object" id="ref-for-idl-object"><c- b>object</c-></a> <dfn class="idl-code" data-dfn-for="BluetoothManufacturerDataFilter/BluetoothManufacturerDataFilter(init)" data-dfn-type="argument" data-export id="dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter-init-init"><code><c- g>init</c-></code><a class="self-link" href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter-init-init"></a></dfn>)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothmanufacturerdatafilter"><code><c- g>BluetoothManufacturerDataFilter</c-></code></dfn> {
  <c- b>readonly</c-> <c- b>maplike</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short"><c- b>unsigned</c-> <c- b>short</c-></a>, <a class="n" data-link-type="idl-name" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter"><c- n>BluetoothDataFilter</c-></a>>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter" id="ref-for-dom-bluetoothservicedatafilter-bluetoothservicedatafilter"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-object" id="ref-for-idl-object①"><c- b>object</c-></a> <dfn class="idl-code" data-dfn-for="BluetoothServiceDataFilter/BluetoothServiceDataFilter(init)" data-dfn-type="argument" data-export id="dom-bluetoothservicedatafilter-bluetoothservicedatafilter-init-init"><code><c- g>init</c-></code><a class="self-link" href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter-init-init"></a></dfn>)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothservicedatafilter"><code><c- g>BluetoothServiceDataFilter</c-></code></dfn> {
  <c- b>readonly</c-> <c- b>maplike</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid" id="ref-for-typedefdef-uuid"><c- n>UUID</c-></a>, <a class="n" data-link-type="idl-name" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter①"><c- n>BluetoothDataFilter</c-></a>>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter" id="ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter①"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit①"><c- n>BluetoothLEScanFilterInit</c-></a> <dfn class="idl-code" data-dfn-for="BluetoothLEScanFilter/BluetoothLEScanFilter(init)" data-dfn-type="argument" data-export id="dom-bluetoothlescanfilter-bluetoothlescanfilter-init-init"><code><c- g>init</c-></code><a class="self-link" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter-init-init"></a></dfn>)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothlescanfilter"><code><c- g>BluetoothLEScanFilter</c-></code></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString"><c- b>DOMString</c-></a>? <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="attribute" data-export data-readonly data-type="DOMString?" id="dom-bluetoothlescanfilter-name"><code><c- g>name</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①"><c- b>DOMString</c-></a>? <dfn class="idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="attribute" data-export data-readonly data-type="DOMString?" id="dom-bluetoothlescanfilter-nameprefix"><code><c- g>namePrefix</c-></code><a class="self-link" href="#dom-bluetoothlescanfilter-nameprefix"></a></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid" id="ref-for-typedefdef-uuid①"><c- n>UUID</c-></a>>? <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="attribute" data-export data-readonly data-type="FrozenArray<UUID>?" id="dom-bluetoothlescanfilter-services"><code><c- g>services</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#bluetoothmanufacturerdatafilter" id="ref-for-bluetoothmanufacturerdatafilter"><c- n>BluetoothManufacturerDataFilter</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="attribute" data-export data-readonly data-type="BluetoothManufacturerDataFilter" id="dom-bluetoothlescanfilter-manufacturerdata"><code><c- g>manufacturerData</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#bluetoothservicedatafilter" id="ref-for-bluetoothservicedatafilter"><c- n>BluetoothServiceDataFilter</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="attribute" data-export data-readonly data-type="BluetoothServiceDataFilter" id="dom-bluetoothlescanfilter-servicedata"><code><c- g>serviceData</c-></code></dfn>;
};

<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothlescan"><code><c- g>BluetoothLEScan</c-></code></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescanfilter" id="ref-for-bluetoothlescanfilter①"><c- n>BluetoothLEScanFilter</c-></a>> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScan" data-dfn-type="attribute" data-export data-readonly data-type="FrozenArray<BluetoothLEScanFilter>" id="dom-bluetoothlescan-filters"><code><c- g>filters</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean②"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScan" data-dfn-type="attribute" data-export data-readonly data-type="boolean" id="dom-bluetoothlescan-keeprepeateddevices"><code><c- g>keepRepeatedDevices</c-></code></dfn>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean③"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScan" data-dfn-type="attribute" data-export data-readonly data-type="boolean" id="dom-bluetoothlescan-acceptalladvertisements"><code><c- g>acceptAllAdvertisements</c-></code></dfn>;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean④"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScan" data-dfn-type="attribute" data-export data-readonly data-type="boolean" id="dom-bluetoothlescan-active"><code><c- g>active</c-></code></dfn>;

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-bluetoothlescan-stop" id="ref-for-dom-bluetoothlescan-stop"><c- g>stop</c-></a>();
};
</pre>
     <div class="note no-marker" role="note">
      <div class="marker">NOTE: <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan③">BluetoothLEScan</a></code> members</div>
      <p> <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-stop" id="ref-for-dom-bluetoothlescan-stop①">BluetoothLEScan.stop()</a></code> stops a previously-requested scan.
        Sites should do this as soon as possible to avoid wasting power. </p>
     </div>
     <div class="algorithm" data-algorithm="BluetoothLEScanFilter(init)">
      <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="constructor" data-export data-lt="BluetoothLEScanFilter(init)|BluetoothLEScanFilter()" id="dom-bluetoothlescanfilter-bluetoothlescanfilter"><code>BluetoothLEScanFilter(<var>init</var>)</code></dfn> constructor, when invoked MUST perform the following steps: </p>
      <ol class="algorithm">
       <li> Initialize all nullable fields to <code>null</code>. 
       <li>
         If no member of <var>init</var> is present, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②">TypeError</a></code>. 
        <p class="note" role="note"><span>Note:</span> A filter can’t implicitly allow all advertisements.
          Use <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanoptions-acceptalladvertisements" id="ref-for-dom-bluetoothlescanoptions-acceptalladvertisements①">acceptAllAdvertisements</a></code> to explicitly do it.</p>
       <li> Initialize <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-manufacturerdata" id="ref-for-dom-bluetoothlescanfilter-manufacturerdata">manufacturerData</a></code> as <code>new BluetoothManufacturerDataFilter(<var>init</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-manufacturerdata" id="ref-for-dom-bluetoothlescanfilterinit-manufacturerdata">manufacturerData</a></code>)</code>. 
       <li> Initialize <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-servicedata" id="ref-for-dom-bluetoothlescanfilter-servicedata">serviceData</a></code> as <code>new BluetoothManufacturerDataFilter(<var>init</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-servicedata" id="ref-for-dom-bluetoothlescanfilterinit-servicedata">serviceData</a></code>)</code>. 
       <li> If <code><var>init</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-services" id="ref-for-dom-bluetoothlescanfilterinit-services">services</a></code></code> is present,
          initialize <code>this.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-services" id="ref-for-dom-bluetoothlescanfilter-services">services</a></code></code> as <code><code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice" id="ref-for-dom-bluetoothuuid-getservice">BluetoothUUID.getService</a></code>(<var>init</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-services" id="ref-for-dom-bluetoothlescanfilterinit-services①">services</a></code></code>. 
       <li> For each other <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-present" id="ref-for-dfn-present①">present</a> member in <var>init</var>,
          set <code>this</code>'s attribute with a matching identifier to the value of the member. 
       <li> If any of the above calls threw an exception,
          propagate that exception from this constructor. 
      </ol>
     </div>
     <div class="algorithm" data-algorithm="stop()">
      <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScan" data-dfn-type="method" data-export id="dom-bluetoothlescan-stop"><code>stop()</code></dfn> method, when invoked,
        MUST perform the following steps: </p>
      <ol class="algorithm">
       <li>Set <code>this.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-active" id="ref-for-dom-bluetoothlescan-active①">active</a></code></code> to <code>false</code>.
       <li>Remove <code>this</code> from <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot③">[[activeScans]]</a></code></code>.
       <li> The UA SHOULD reconfigure or stop its BLE scan to save power
          while still receiving any advertisements that <a data-link-type="dfn" href="#bluetoothlescan-match" id="ref-for-bluetoothlescan-match①">match</a> any scan
          in any <code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot④">[[activeScans]]</a></code> set in the whole UA. 
      </ol>
     </div>
     <div class="algorithm" data-algorithm="BluetoothManufacturerDataFilter(init)">
      <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothManufacturerDataFilter" data-dfn-type="constructor" data-export data-lt="BluetoothManufacturerDataFilter(init)|BluetoothManufacturerDataFilter()" id="dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter"><code>BluetoothManufacturerDataFilter(<var>init</var>)</code></dfn> constructor, when invoked, MUST perform the following steps: </p>
      <ol>
       <li> If <var>init</var> is not present
          or <code><var>init</var>.<code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" id="ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">[[OwnPropertyKeys]]</a></code>()</code> is empty,
          then <code>this</code> has no <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries">map entries</a>.
          Abort these steps. 
       <li> Let <var>canonicalInit</var> be the <code>manufacturerData</code> field of the result of <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing" id="ref-for-bluetoothlescanfilterinit-canonicalizing">canonicalizing</a> <code>{manufacturerData: <var>init</var>}</code>.
          If this throws an exception,
          propagate that exception from this constructor and abort these steps. 
       <li> <code>this</code>'s <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries①">map entries</a> map from each <var>key</var> in <code><var>canonicalInit</var>.<code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" id="ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys①">[[OwnPropertyKeys]]</a></code>()</code>,
          parsed as a base-10 integer,
          to its value of <code>new <code class="idl"><a data-link-type="idl" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter②">BluetoothDataFilter</a></code>(<var>canonicalInit</var>[<var>key</var>])</code>. 
      </ol>
     </div>
     <div class="algorithm" data-algorithm="BluetoothServiceDataFilter(init)">
      <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothServiceDataFilter" data-dfn-type="constructor" data-export data-lt="BluetoothServiceDataFilter(init)|BluetoothServiceDataFilter()" id="dom-bluetoothservicedatafilter-bluetoothservicedatafilter"><code>BluetoothServiceDataFilter(<var>init</var>)</code></dfn> constructor, when invoked, MUST perform the following steps: </p>
      <ol>
       <li> If <var>init</var> is not present
          or <code><var>init</var>.<code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" id="ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys②">[[OwnPropertyKeys]]</a></code>()</code> is empty,
          then <code>this</code> has no <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries②">map entries</a>.
          Abort these steps. 
       <li> Let <var>canonicalInit</var> be the <code>serviceData</code> field of the result of <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing" id="ref-for-bluetoothlescanfilterinit-canonicalizing①">canonicalizing</a> <code>{serviceData: <var>init</var>}</code>.
          If this throws an exception,
          propagate that exception from this constructor and abort these steps. 
       <li> <code>this</code>'s <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries③">map entries</a> map from each <var>key</var> in <code><var>canonicalInit</var>.<code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" id="ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys③">[[OwnPropertyKeys]]</a></code>()</code>,
          to its value of <code>new <code class="idl"><a data-link-type="idl" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter③">BluetoothDataFilter</a></code>(<var>canonicalInit</var>[<var>key</var>])</code>. 
      </ol>
     </div>
     <div class="algorithm" data-algorithm="BluetoothDataFilter(init)">
      <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothDataFilter" data-dfn-type="constructor" data-export data-lt="BluetoothDataFilter(init)|BluetoothDataFilter()" id="dom-bluetoothdatafilter-bluetoothdatafilter"><code>BluetoothDataFilter(<var>init</var>)</code></dfn> constructor, when invoked, MUST perform the following steps: </p>
      <ol>
       <li> Let <var>canonicalInit</var> be
          the result of <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdatafilterinit-canonicalizing" id="ref-for-bluetoothdatafilterinit-canonicalizing">canonicalizing</a> <var>init</var>.
          If this throws an exception,
          propagate that exception from this constructor and abort these steps. 
       <li> Initialize <code>this.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothdatafilter-dataprefix" id="ref-for-dom-bluetoothdatafilter-dataprefix">dataPrefix</a></code></code> as
          a <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#read-only-arraybuffer" id="ref-for-read-only-arraybuffer">read only ArrayBuffer</a> whose contents are <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy">a copy of the bytes held</a> by <code><var>canonicalInit</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-dataprefix" id="ref-for-dom-bluetoothdatafilterinit-dataprefix">dataPrefix</a></code></code>. 
       <li> Initialize <code>this.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothdatafilter-mask" id="ref-for-dom-bluetoothdatafilter-mask">mask</a></code></code> as
          a <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#read-only-arraybuffer" id="ref-for-read-only-arraybuffer①">read only ArrayBuffer</a> whose contents are <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy①">a copy of the bytes held</a> by <code><var>canonicalInit</var>.<code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-mask" id="ref-for-dom-bluetoothdatafilterinit-mask">mask</a></code></code>. 
      </ol>
     </div>
    </section>
    <section>
     <h3 class="heading settled" data-level="4.2" id="permission"><span class="secno">4.2. </span><span class="content">Permission to scan</span><a class="self-link" href="#permission"></a></h3>
     <p> The <dfn class="dfn-paneled idl-code" data-dfn-for="PermissionName" data-dfn-type="enum-value" data-export id="dom-permissionname-bluetooth-le-scan"><code>"bluetooth-le-scan"</code></dfn> <a data-link-type="dfn" href="https://w3c.github.io/permissions/#powerful-feature" id="ref-for-powerful-feature">powerful feature</a>’s
      permission-related algorithms and types
      are defined as follows: </p>
     <dl>
      <dt><a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-descriptor-type" id="ref-for-permission-descriptor-type">permission descriptor type</a>
      <dd>
<pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-bluetoothlescanpermissiondescriptor"><code><c- g>BluetoothLEScanPermissionDescriptor</c-></code></dfn> : <a class="n" data-link-type="idl-name" href="https://w3c.github.io/permissions/#dictdef-permissiondescriptor" id="ref-for-dictdef-permissiondescriptor"><c- n>PermissionDescriptor</c-></a> {
  // These match BluetoothLEScanOptions.
  <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit②"><c- n>BluetoothLEScanFilterInit</c-></a>> <dfn class="idl-code" data-dfn-for="BluetoothLEScanPermissionDescriptor" data-dfn-type="dict-member" data-export data-type="sequence<BluetoothLEScanFilterInit> " id="dom-bluetoothlescanpermissiondescriptor-filters"><code><c- g>filters</c-></code><a class="self-link" href="#dom-bluetoothlescanpermissiondescriptor-filters"></a></dfn>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean⑤"><c- b>boolean</c-></a> <dfn class="idl-code" data-default="false" data-dfn-for="BluetoothLEScanPermissionDescriptor" data-dfn-type="dict-member" data-export data-type="boolean " id="dom-bluetoothlescanpermissiondescriptor-keeprepeateddevices"><code><c- g>keepRepeatedDevices</c-></code><a class="self-link" href="#dom-bluetoothlescanpermissiondescriptor-keeprepeateddevices"></a></dfn> = <c- b>false</c->;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean⑥"><c- b>boolean</c-></a> <dfn class="idl-code" data-default="false" data-dfn-for="BluetoothLEScanPermissionDescriptor" data-dfn-type="dict-member" data-export data-type="boolean " id="dom-bluetoothlescanpermissiondescriptor-acceptalladvertisements"><code><c- g>acceptAllAdvertisements</c-></code><a class="self-link" href="#dom-bluetoothlescanpermissiondescriptor-acceptalladvertisements"></a></dfn> = <c- b>false</c->;
};
</pre>
      <dt><a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-result-type" id="ref-for-permission-result-type">permission result type</a>
      <dd>
<pre class="idl highlight def"><c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bluetoothlescanpermissionresult"><code><c- g>BluetoothLEScanPermissionResult</c-></code></dfn> : <a class="n" data-link-type="idl-name" href="https://w3c.github.io/permissions/#permissionstatus" id="ref-for-permissionstatus"><c- n>PermissionStatus</c-></a> {
  <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescan" id="ref-for-bluetoothlescan④"><c- n>BluetoothLEScan</c-></a>> <dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothLEScanPermissionResult" data-dfn-type="attribute" data-export data-type="FrozenArray<BluetoothLEScan>" id="dom-bluetoothlescanpermissionresult-scans"><code><c- g>scans</c-></code></dfn>;
};
</pre>
      <dt><a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-query-algorithm" id="ref-for-permission-query-algorithm">permission query algorithm</a>
      <dd class="algorithm" data-algorithm="permission-query">
       <p> Given a <code class="idl"><a data-link-type="idl" href="#dictdef-bluetoothlescanpermissiondescriptor" id="ref-for-dictdef-bluetoothlescanpermissiondescriptor">BluetoothLEScanPermissionDescriptor</a></code> <var>descriptor</var> and a <code class="idl"><a data-link-type="idl" href="#bluetoothlescanpermissionresult" id="ref-for-bluetoothlescanpermissionresult">BluetoothLEScanPermissionResult</a></code> <var>result</var>: </p>
       <ol class="algorithm">
        <li> Update <code><var>result</var>.<code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstatus-state" id="ref-for-dom-permissionstatus-state">state</a></code></code> to <var>descriptor</var>’s <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state">permission state</a>. 
        <li> If <code><var>result</var>.<code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstatus-state" id="ref-for-dom-permissionstatus-state①">state</a></code></code> is <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstate-denied" id="ref-for-dom-permissionstate-denied①">"denied"</a></code>,
            set <code><var>result</var>.scans</code> to an empty <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-frozen-array" id="ref-for-idl-frozen-array">FrozenArray</a></code> and abort these steps. 
        <li>
          Update <code><var>result</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanpermissionresult-scans" id="ref-for-dom-bluetoothlescanpermissionresult-scans">scans</a></code></code> to
            a new <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-frozen-array" id="ref-for-idl-frozen-array①">FrozenArray</a></code> containing
            the elements of <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot⑤">[[activeScans]]</a></code></code>. 
         <p class="issue" id="issue-should-query-filter"><a class="self-link" href="#issue-should-query-filter"></a> Consider filtering the result to active scans that
              match the fields of the descriptor. </p>
       </ol>
      <dt><a data-link-type="dfn" href="https://wicg.github.io/permissions-request/#permission-request-algorithm" id="ref-for-permission-request-algorithm">permission request algorithm</a>
      <dd class="algorithm" data-algorithm="permission-request">
       <p> Given a <code class="idl"><a data-link-type="idl" href="#dictdef-bluetoothlescanpermissiondescriptor" id="ref-for-dictdef-bluetoothlescanpermissiondescriptor①">BluetoothLEScanPermissionDescriptor</a></code> <var>descriptor</var> and a <code class="idl"><a data-link-type="idl" href="#bluetoothlescanpermissionresult" id="ref-for-bluetoothlescanpermissionresult①">BluetoothLEScanPermissionResult</a></code> <var>result</var>: </p>
       <ol class="algorithm">
        <li> Let <var>promise</var> be the result of <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan④">requestLEScan</a></code>(<var>descriptor</var>)</code>. 
        <li>Wait for <var>promise</var> to settle.
        <li> If <var>promise</var> rejected, throw the reason it rejected with,
            and abort these steps. 
        <li> Update <code><var>result</var>.status</code> to <var>descriptor</var>’s <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state①">permission state</a>. 
        <li> Update <code><var>result</var>.scans</code> to
            a new <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-frozen-array" id="ref-for-idl-frozen-array②">FrozenArray</a></code> whose single element is the value in <var>promise</var>. 
       </ol>
      <dt> <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-revocation-algorithm" id="ref-for-permission-revocation-algorithm">permission revocation algorithm</a> 
      <dd class="algorithm" data-algorithm="permission-revocation">
       <ol class="algorithm">
        <li>
          For each <var>activeScan</var> in <code>navigator.bluetooth.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot⑥">[[activeScans]]</a></code></code>: 
         <ol>
          <li>
            If the <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state②">permission state</a> of 
<pre class="highlight"><c- p>{</c->
  name<c- o>:</c-> <c- u>"bluetooth-le-scan"</c-><c- p>,</c->
  filters<c- o>:</c-> <var>activeScan</var><c- p>.</c->filters<c- p>,</c->
  keepRepeatedDevices<c- o>:</c-> <var>activeScan</var><c- p>.</c->keepRepeatedDevices
<c- p>}</c->
</pre>
           <p>is not <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstate-granted" id="ref-for-dom-permissionstate-granted">"granted"</a></code>,
                call <code><var>activeScan</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-stop" id="ref-for-dom-bluetoothlescan-stop②">stop()</a></code></code>.</p>
         </ol>
       </ol>
     </dl>
    </section>
   </section>
   <section>
    <h2 class="heading settled" data-level="5" id="events"><span class="secno">5. </span><span class="content">Event handling</span><a class="self-link" href="#events"></a></h2>
    <section>
     <h3 class="heading settled" data-level="5.1" id="advertising-events"><span class="secno">5.1. </span><span class="content">Responding to advertising events</span><a class="self-link" href="#advertising-events"></a></h3>
     <div class="algorithm" data-algorithm="receive-advertising-event">
      <p> When the UA receives an <a data-link-type="dfn" href="#advertising-event" id="ref-for-advertising-event">advertising event</a> <var>event</var> (consisting of an advertising packet and an optional scan response),
        it MUST run the following steps: </p>
      <ol class="algorithm">
       <li> Let <var>device</var> be the <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth-device" id="ref-for-bluetooth-device">Bluetooth device</a> that sent the advertising event. 
       <li>
         For each <code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth" id="ref-for-bluetooth①">Bluetooth</a></code> instance <var>bluetooth</var> in the UA, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task">queue a task</a> on <var>bluetooth</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object">relevant settings object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-event-loop" id="ref-for-responsible-event-loop">responsible event loop</a> to do the following sub-steps: 
        <ol>
         <li> Let <var>scans</var> be the set of <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan⑤">BluetoothLEScan</a></code>s in <code><var>bluetooth</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetooth-activescans-slot" id="ref-for-dom-bluetooth-activescans-slot⑦">[[activeScans]]</a></code></code> that <a data-link-type="dfn" href="#bluetoothlescan-match" id="ref-for-bluetoothlescan-match②">match</a> <var>event</var>. 
         <li>If <var>scans</var> is empty, abort these sub-steps.
         <li class="note"> Note: the user’s <a href="#scanning-permission">permission to scan</a> likely indicates that
              they intend newly-discovered devices to appear in <code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-permissionname-bluetooth" id="ref-for-dom-permissionname-bluetooth">"bluetooth"</a></code>'s <a data-link-type="dfn" href="https://w3c.github.io/permissions/#extra-permission-data" id="ref-for-extra-permission-data">extra permission data</a>,
              but possibly with <code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#dom-allowedbluetoothdevice-mayusegatt" id="ref-for-dom-allowedbluetoothdevice-mayusegatt">mayUseGATT</a></code> set to <code>false</code>. 
         <li> <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#get-the-bluetoothdevice-representing" id="ref-for-get-the-bluetoothdevice-representing">Get the <code>BluetoothDevice</code> representing</a> <var>device</var> inside <var>bluetooth</var>,
              and let <var>deviceObj</var> be the result. 
         <li> Add each <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan⑥">BluetoothLEScan</a></code> in <var>scans</var> to <code><var>deviceObj</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothdevice-returnedfromscans-slot" id="ref-for-dom-bluetoothdevice-returnedfromscans-slot">[[returnedFromScans]]</a></code></code>. 
         <li> <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#fire-an-advertisementreceived-event" id="ref-for-fire-an-advertisementreceived-event">Fire an <code>advertisementreceived</code> event</a> for <var>event</var> at <var>deviceObj</var>. 
        </ol>
      </ol>
     </div>
     <div class="algorithm" data-algorithm="bluetoothlescan-match">
      <p> An advertising event <var>event</var> <dfn class="dfn-paneled" data-dfn-for="BluetoothLEScan" data-dfn-type="dfn" data-lt="match" data-noexport id="bluetoothlescan-match">matches</dfn> a <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan⑦">BluetoothLEScan</a></code> <var>scan</var> if the following steps return <code>match</code>: </p>
      <ol class="algorithm">
       <li> <code><var>scan</var>.acceptAllAdvertisements</code> is <code>false</code> and <var>event</var> doesn’t <a data-link-type="dfn" href="#bluetoothlescanfilter-match" id="ref-for-bluetoothlescanfilter-match①">match</a> any filter in <code><var>scan</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-filters" id="ref-for-dom-bluetoothlescan-filters①">filters</a></code></code>,
          return <code>no match</code>. 
       <li> If <code><var>scan</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-keeprepeateddevices" id="ref-for-dom-bluetoothlescan-keeprepeateddevices①">keepRepeatedDevices</a></code></code> is <code>false</code>,
          there is a <code class="idl"><a data-link-type="idl" href="index.html#bluetoothdevice" id="ref-for-bluetoothdevice①">BluetoothDevice</a></code> <var>device</var> that
          represents the <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#same-bluetooth-device" id="ref-for-same-bluetooth-device">same Bluetooth device</a> as the one that sent <var>event</var>,
          and <code><var>device</var>.<code class="idl"><a data-link-type="idl" href="#dom-bluetoothdevice-returnedfromscans-slot" id="ref-for-dom-bluetoothdevice-returnedfromscans-slot①">[[returnedFromScans]]</a></code></code> includes <var>scan</var>,
          the UA MAY return <code>no match</code>. 
       <li>Return <code>match</code>.
      </ol>
     </div>
     <div class="algorithm" data-algorithm="bluetoothlescanfilter-match">
      <p> An advertising event <var>event</var> <dfn class="dfn-paneled" data-dfn-for="BluetoothLEScanFilter" data-dfn-type="dfn" data-lt="match" data-noexport id="bluetoothlescanfilter-match">matches</dfn> a <code class="idl"><a data-link-type="idl" href="#bluetoothlescanfilter" id="ref-for-bluetoothlescanfilter②">BluetoothLEScanFilter</a></code> <var>filter</var> if all of the following conditions hold: </p>
      <ul>
       <li>
         If <code><var>filter</var>.name</code> is non-<code>null</code>, <var>event</var> has a <a data-link-type="dfn" href="#local-name" id="ref-for-local-name">Local Name</a> equal to <code><var>filter</var>.name</code>. 
        <p class="note" role="note"><span>Note:</span> A <a data-link-type="dfn" href="#shortened-local-name" id="ref-for-shortened-local-name">Shortened Local Name</a> can match a <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-name" id="ref-for-dom-bluetoothlescanfilter-name">name</a></code> filter.</p>
       <li> If <code><var>filter</var>.namePrefix</code> is non-<code>null</code>, <var>event</var> has a <a data-link-type="dfn" href="#local-name" id="ref-for-local-name①">Local Name</a>,
          and <code><var>filter</var>.namePrefix</code> is a prefix of it. 
       <li> If <code><var>filter</var>.serviceUUID</code> is non-<code>null</code>,
          it is equal to a <a data-link-type="dfn" href="#service-uuid" id="ref-for-service-uuid">Service UUID</a> in <var>event</var>. 
       <li> For each (<var>id</var>, <var>filter</var>) in <code><var>filter</var>.manufacturerData</code>’s <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries④">map entries</a>,
          some <a data-link-type="dfn" href="#manufacturer-specific-data" id="ref-for-manufacturer-specific-data">Manufacturer Specific Data</a> in <var>event</var> has a Company Identifier Code of <var>id</var>,
          and whose array of bytes <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdatafilterinit-matches" id="ref-for-bluetoothdatafilterinit-matches">matches</a> <var>filter</var>. 
       <li> For each (<var>uuid</var>, <var>filter</var>) in <code><var>filter</var>.serviceData</code>’s <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-map-entries" id="ref-for-dfn-map-entries⑤">map entries</a>,
          some <a data-link-type="dfn" href="#service-data" id="ref-for-service-data">Service Data</a> in <var>event</var> has a UUID whose 128-bit representation is <var>uuid</var>,
          and whose array of bytes <a data-link-type="dfn" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdatafilterinit-matches" id="ref-for-bluetoothdatafilterinit-matches①">matches</a> <var>filter</var>. 
      </ul>
     </div>
    </section>
   </section>
   <section>
    <h2 class="heading settled" data-level="6" id="changes"><span class="secno">6. </span><span class="content">Changes to existing interfaces</span><a class="self-link" href="#changes"></a></h2>
    <p> Instances of <code class="idl"><a data-link-type="idl" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth" id="ref-for-bluetooth②">Bluetooth</a></code> additionally have the following internal slots: </p>
    <table class="data">
     <thead>
      <tr>
       <th>Internal Slot
       <th>Initial Value
       <th>Description (non-normative)
     <tbody>
      <tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="Bluetooth" data-dfn-type="attribute" data-export id="dom-bluetooth-activescans-slot"><code>[[activeScans]]</code></dfn>
       <td> An empty set of <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan⑧">BluetoothLEScan</a></code> instances. 
       <td> The contents of this set will have <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescan-active" id="ref-for-dom-bluetoothlescan-active②">active</a></code> equal to <code>true</code>. 
    </table>
    <p> Instances of <code class="idl"><a data-link-type="idl" href="index.html#bluetoothdevice" id="ref-for-bluetoothdevice②">BluetoothDevice</a></code> additionally have the following internal slots: </p>
    <table class="data">
     <thead>
      <tr>
       <th>Internal Slot
       <th>Initial Value
       <th>Description (non-normative)
     <tbody>
      <tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="BluetoothDevice" data-dfn-type="attribute" data-export id="dom-bluetoothdevice-returnedfromscans-slot"><code>[[returnedFromScans]]</code></dfn>
       <td> An empty set of <code class="idl"><a data-link-type="idl" href="#bluetoothlescan" id="ref-for-bluetoothlescan⑨">BluetoothLEScan</a></code> objects. 
       <td> Used to implement <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanoptions-keeprepeateddevices" id="ref-for-dom-bluetoothlescanoptions-keeprepeateddevices②">keepRepeatedDevices</a></code>. 
    </table>
   </section>
   <section>
    <h2 class="heading settled" data-level="7" id="terminology"><span class="secno">7. </span><span class="content">Terminology and conventions</span><a class="self-link" href="#terminology"></a></h2>
    <p> This specification uses a few conventions and several terms from other specifications.
    This section lists those and links to their primary definitions. </p>
    <p> When an algorithm in this specification uses a name defined in this or another specification,
    the name MUST resolve to its initial value,
    ignoring any changes that have been made to the name in the current execution environment.
    For example, when the <code class="idl"><a data-link-type="idl" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan⑤">requestLEScan()</a></code> algorithm says to call <code><var>options</var>.filters.map(filter=>new <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter" id="ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter②">BluetoothLEScanFilter</a></code>(filter))</code>,
    this MUST apply the <code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-array.prototype.map" id="ref-for-sec-array.prototype.map">Array.prototype.map</a></code> algorithm defined in <a data-link-type="biblio" href="#biblio-ecmascript">[ECMAScript]</a> with <code><var>options</var>.services</code> as its <code>this</code> parameter and
    the algorithm defined at <code class="idl"><a data-link-type="idl" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter" id="ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter③">BluetoothLEScanFilter()</a></code> as its <code>callbackfn</code> parameter,
    regardless of any modifications that have been made to <code>window</code>, <code>Array</code>, <code>Array.prototype</code>, <code>Array.prototype.map</code>, <code>Function</code>, <code>Function.prototype</code>, <code>BluetoothLEScanFilter</code>, or other objects. </p>
    <dl>
     <dt><a data-link-type="biblio" href="#biblio-bluetooth42">[BLUETOOTH42]</a>
     <dd>
      <ol>
       <li value="1">
        Architecture &amp; Terminology Overview 
        <ol type="A">
         <li value="1">
          General Description 
          <ol>
           <li value="2">Overview of Bluetooth Low Energy Operation
                  (defines <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="advertising event|advertising events" data-noexport id="advertising-event">advertising events</dfn>) 
          </ol>
        </ol>
       <li value="3">
        Core System Package [Host volume] 
        <ol type="A">
         <li value="3">
          Generic Access Profile 
          <ol>
           <li value="2">
            Profile Overview 
            <ol>
             <li value="2">
              Profile Roles 
              <ol>
               <li value="2">
                Roles when Operating over an LE Physical Transport 
                <ol>
                 <li value="2"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="observer">Observer</dfn> Role
                </ol>
              </ol>
            </ol>
           <li value="10">
            Security Aspects — LE Physical Transport 
            <ol>
             <li value="7">
              <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="privacy-feature">Privacy Feature</dfn> 
              <ol>
               <li value="4"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="privacy-feature-in-an-observer">Privacy Feature in an Observer</dfn> 
              </ol>
            </ol>
          </ol>
        </ol>
       <li value="6">
        Core System Package [Low Energy Controller volume] 
        <ol type="A">
         <li value="2">
          Link Layer Specification 
          <ol>
           <li value="1">
            General Description 
            <ol>
             <li value="3"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="device-address">Device Address</dfn>
            </ol>
           <li value="2">
            Air Interface Packets 
            <ol>
             <li value="3">
              Advertising Channel PDU 
              <ol>
               <li value="1">
                Advertising PDUs 
                <ol>
                 <li value="1">ADV_IND
                 <li value="2">ADV_DIRECT_IND
                 <li value="3">ADV_NONCONN_IND
                 <li value="4">ADV_SCAN_IND
                </ol>
              </ol>
            </ol>
           <li value="4">
            Air Interface Protocol 
            <ol>
             <li value="4">
              Non-Connected States 
              <ol>
               <li value="3">
                Scanning State 
                <ol>
                 <li value="1"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="passive-scanning">Passive Scanning</dfn>
                 <li value="2"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="active-scanning">Active Scanning</dfn>
                </ol>
              </ol>
            </ol>
          </ol>
        </ol>
      </ol>
     <dt><a data-link-type="biblio" href="#biblio-bluetooth-supplement6">[BLUETOOTH-SUPPLEMENT6]</a>
     <dd>
      <ol type="A">
       <li value="1">
        Data Types Specification 
        <ol>
         <li value="1">
          Data Types Definitions and Formats 
          <ol>
           <li value="1"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="service-uuid">Service UUID</dfn>
           <li value="1"> <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="local-name">Local Name</dfn> also defines <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="shortened-local-name">Shortened Local Name</dfn> and Complete Local Name 
           <li value="4"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="manufacturer-specific-data">Manufacturer Specific Data</dfn>
           <li value="11"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="service-data">Service Data</dfn>
          </ol>
        </ol>
      </ol>
    </dl>
   </section>
  </main>
  <div data-fill-with="conformance">
   <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
   <p> Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology.
            The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL”
            in the normative parts of this document
            are to be interpreted as described in RFC 2119.
            However, for readability,
            these words do not appear in all uppercase letters in this specification. </p>
   <p> All of the text of this specification is normative
            except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
   <p> Examples in this specification are introduced with the words “for example”
            or are set apart from the normative text with <code>class="example"</code>, like this: </p>
   <div class="example" id="example-example"><a class="self-link" href="#example-example"></a> This is an example of an informative example. </div>
   <p> Informative notes begin with the word “Note”
            and are set apart from the normative text with <code>class="note"</code>, like this: </p>
   <p class="note" role="note"> Note, this is an informative note. </p>
  </div>
<script>
(function() {
  "use strict";
  var collapseSidebarText = '<span aria-hidden="true">←</span> '
                          + '<span>Collapse Sidebar</span>';
  var expandSidebarText   = '<span aria-hidden="true">→</span> '
                          + '<span>Pop Out Sidebar</span>';
  var tocJumpText         = '<span aria-hidden="true">↑</span> '
                          + '<span>Jump to Table of Contents</span>';

  var sidebarMedia = window.matchMedia('screen and (min-width: 78em)');
  var autoToggle   = function(e){ toggleSidebar(e.matches) };
  if(sidebarMedia.addListener) {
    sidebarMedia.addListener(autoToggle);
  }

  function toggleSidebar(on) {
    if (on == undefined) {
      on = !document.body.classList.contains('toc-sidebar');
    }

    /* Don’t scroll to compensate for the ToC if we’re above it already. */
    var headY = 0;
    var head = document.querySelector('.head');
    if (head) {
      // terrible approx of "top of ToC"
      headY += head.offsetTop + head.offsetHeight;
    }
    var skipScroll = window.scrollY < headY;

    var toggle = document.getElementById('toc-toggle');
    var tocNav = document.getElementById('toc');
    if (on) {
      var tocHeight = tocNav.offsetHeight;
      document.body.classList.add('toc-sidebar');
      document.body.classList.remove('toc-inline');
      toggle.innerHTML = collapseSidebarText;
      if (!skipScroll) {
        window.scrollBy(0, 0 - tocHeight);
      }
      tocNav.focus();
      sidebarMedia.addListener(autoToggle); // auto-collapse when out of room
    }
    else {
      document.body.classList.add('toc-inline');
      document.body.classList.remove('toc-sidebar');
      toggle.innerHTML = expandSidebarText;
      if (!skipScroll) {
        window.scrollBy(0, tocNav.offsetHeight);
      }
      if (toggle.matches(':hover')) {
        /* Unfocus button when not using keyboard navigation,
           because I don’t know where else to send the focus. */
        toggle.blur();
      }
    }
  }

  function createSidebarToggle() {
    /* Create the sidebar toggle in JS; it shouldn’t exist when JS is off. */
    var toggle = document.createElement('a');
      /* This should probably be a button, but appearance isn’t standards-track.*/
    toggle.id = 'toc-toggle';
    toggle.class = 'toc-toggle';
    toggle.href = '#toc';
    toggle.innerHTML = collapseSidebarText;

    sidebarMedia.addListener(autoToggle);
    var toggler = function(e) {
      e.preventDefault();
      sidebarMedia.removeListener(autoToggle); // persist explicit off states
      toggleSidebar();
      return false;
    }
    toggle.addEventListener('click', toggler, false);


    /* Get <nav id=toc-nav>, or make it if we don’t have one. */
    var tocNav = document.getElementById('toc-nav');
    if (!tocNav) {
      tocNav = document.createElement('p');
      tocNav.id = 'toc-nav';
      /* Prepend for better keyboard navigation */
      document.body.insertBefore(tocNav, document.body.firstChild);
    }
    /* While we’re at it, make sure we have a Jump to Toc link. */
    var tocJump = document.getElementById('toc-jump');
    if (!tocJump) {
      tocJump = document.createElement('a');
      tocJump.id = 'toc-jump';
      tocJump.href = '#toc';
      tocJump.innerHTML = tocJumpText;
      tocNav.appendChild(tocJump);
    }

    tocNav.appendChild(toggle);
  }

  var toc = document.getElementById('toc');
  if (toc) {
    createSidebarToggle();
    toggleSidebar(sidebarMedia.matches);

    /* If the sidebar has been manually opened and is currently overlaying the text
       (window too small for the MQ to add the margin to body),
       then auto-close the sidebar once you click on something in there. */
    toc.addEventListener('click', function(e) {
      if(e.target.tagName.toLowerCase() == "a" && document.body.classList.contains('toc-sidebar') && !sidebarMedia.matches) {
        toggleSidebar(false);
      }
    }, false);
  }
  else {
    console.warn("Can’t find Table of Contents. Please use <nav id='toc'> around the ToC.");
  }

  /* Wrap tables in case they overflow */
  var tables = document.querySelectorAll(':not(.overlarge) > table.data, :not(.overlarge) > table.index');
  var numTables = tables.length;
  for (var i = 0; i < numTables; i++) {
    var table = tables[i];
    var wrapper = document.createElement('div');
    wrapper.className = 'overlarge';
    table.parentNode.insertBefore(wrapper, table);
    wrapper.appendChild(table);
  }

})();
</script>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li>
    acceptAllAdvertisements
    <ul>
     <li><a href="#dom-bluetoothlescan-acceptalladvertisements">attribute for BluetoothLEScan</a><span>, in §4.1</span>
     <li><a href="#dom-bluetoothlescanoptions-acceptalladvertisements">dict-member for BluetoothLEScanOptions</a><span>, in §4</span>
     <li><a href="#dom-bluetoothlescanpermissiondescriptor-acceptalladvertisements">dict-member for BluetoothLEScanPermissionDescriptor</a><span>, in §4.2</span>
    </ul>
   <li><a href="#dom-bluetoothlescan-active">active</a><span>, in §4.1</span>
   <li><a href="#active-scanning">Active Scanning</a><span>, in §7</span>
   <li><a href="#dom-bluetooth-activescans-slot">[[activeScans]]</a><span>, in §6</span>
   <li><a href="#advertising-event">advertising event</a><span>, in §7</span>
   <li><a href="#advertising-event">advertising events</a><span>, in §7</span>
   <li><a href="#dom-bluetoothdatafilter-bluetoothdatafilter">BluetoothDataFilter()</a><span>, in §4.1</span>
   <li><a href="#bluetoothdatafilter">BluetoothDataFilter</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothdatafilter-bluetoothdatafilter">BluetoothDataFilter(init)</a><span>, in §4.1</span>
   <li><a href="#bluetoothlescan">BluetoothLEScan</a><span>, in §4.1</span>
   <li><a href="#dom-permissionname-bluetooth-le-scan">"bluetooth-le-scan"</a><span>, in §4.2</span>
   <li><a href="#dom-bluetoothlescanfilter-bluetoothlescanfilter">BluetoothLEScanFilter()</a><span>, in §4.1</span>
   <li><a href="#bluetoothlescanfilter">BluetoothLEScanFilter</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothlescanfilter-bluetoothlescanfilter">BluetoothLEScanFilter(init)</a><span>, in §4.1</span>
   <li><a href="#dictdef-bluetoothlescanoptions">BluetoothLEScanOptions</a><span>, in §4</span>
   <li><a href="#dictdef-bluetoothlescanpermissiondescriptor">BluetoothLEScanPermissionDescriptor</a><span>, in §4.2</span>
   <li><a href="#bluetoothlescanpermissionresult">BluetoothLEScanPermissionResult</a><span>, in §4.2</span>
   <li><a href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter">BluetoothManufacturerDataFilter()</a><span>, in §4.1</span>
   <li><a href="#bluetoothmanufacturerdatafilter">BluetoothManufacturerDataFilter</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter">BluetoothManufacturerDataFilter(init)</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter">BluetoothServiceDataFilter()</a><span>, in §4.1</span>
   <li><a href="#bluetoothservicedatafilter">BluetoothServiceDataFilter</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter">BluetoothServiceDataFilter(init)</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothdatafilter-dataprefix">dataPrefix</a><span>, in §4.1</span>
   <li><a href="#device-address">Device Address</a><span>, in §7</span>
   <li>
    filters
    <ul>
     <li><a href="#dom-bluetoothlescan-filters">attribute for BluetoothLEScan</a><span>, in §4.1</span>
     <li><a href="#dom-bluetoothlescanoptions-filters">dict-member for BluetoothLEScanOptions</a><span>, in §4</span>
     <li><a href="#dom-bluetoothlescanpermissiondescriptor-filters">dict-member for BluetoothLEScanPermissionDescriptor</a><span>, in §4.2</span>
    </ul>
   <li>
    keepRepeatedDevices
    <ul>
     <li><a href="#dom-bluetoothlescan-keeprepeateddevices">attribute for BluetoothLEScan</a><span>, in §4.1</span>
     <li><a href="#dom-bluetoothlescanoptions-keeprepeateddevices">dict-member for BluetoothLEScanOptions</a><span>, in §4</span>
     <li><a href="#dom-bluetoothlescanpermissiondescriptor-keeprepeateddevices">dict-member for BluetoothLEScanPermissionDescriptor</a><span>, in §4.2</span>
    </ul>
   <li><a href="#local-name">Local Name</a><span>, in §7</span>
   <li><a href="#dom-bluetoothlescanfilter-manufacturerdata">manufacturerData</a><span>, in §4.1</span>
   <li><a href="#manufacturer-specific-data">Manufacturer Specific Data</a><span>, in §7</span>
   <li><a href="#dom-bluetoothdatafilter-mask">mask</a><span>, in §4.1</span>
   <li>
    match
    <ul>
     <li><a href="#bluetoothlescan-match">dfn for BluetoothLEScan</a><span>, in §5.1</span>
     <li><a href="#bluetoothlescanfilter-match">dfn for BluetoothLEScanFilter</a><span>, in §5.1</span>
    </ul>
   <li><a href="#dom-bluetoothlescanfilter-name">name</a><span>, in §4.1</span>
   <li><a href="#dom-bluetoothlescanfilter-nameprefix">namePrefix</a><span>, in §4.1</span>
   <li><a href="#observer">Observer</a><span>, in §7</span>
   <li><a href="#passive-scanning">Passive Scanning</a><span>, in §7</span>
   <li><a href="#privacy-feature">Privacy Feature</a><span>, in §7</span>
   <li><a href="#privacy-feature-in-an-observer">Privacy Feature in an Observer</a><span>, in §7</span>
   <li><a href="#dom-bluetooth-requestlescan">requestLEScan()</a><span>, in §4</span>
   <li><a href="#dom-bluetooth-requestlescan">requestLEScan(options)</a><span>, in §4</span>
   <li><a href="#dom-bluetoothdevice-returnedfromscans-slot">[[returnedFromScans]]</a><span>, in §6</span>
   <li><a href="#dom-bluetoothlescanpermissionresult-scans">scans</a><span>, in §4.2</span>
   <li><a href="#dom-bluetoothlescanfilter-servicedata">serviceData</a><span>, in §4.1</span>
   <li><a href="#service-data">Service Data</a><span>, in §7</span>
   <li><a href="#dom-bluetoothlescanfilter-services">services</a><span>, in §4.1</span>
   <li><a href="#service-uuid">Service UUID</a><span>, in §7</span>
   <li><a href="#shortened-local-name">Shortened Local Name</a><span>, in §7</span>
   <li><a href="#dom-bluetoothlescan-stop">stop()</a><span>, in §4.1</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-sec-array.prototype.map">
   <a href="https://tc39.github.io/ecma262/#sec-array.prototype.map">https://tc39.github.io/ecma262/#sec-array.prototype.map</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-array.prototype.map">7. Terminology and conventions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-native-error-types-used-in-this-standard-typeerror">
   <a href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror">https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-native-error-types-used-in-this-standard-typeerror">4. Scanning for BLE advertisements</a> <a href="#ref-for-sec-native-error-types-used-in-this-standard-typeerror①">(2)</a>
    <li><a href="#ref-for-sec-native-error-types-used-in-this-standard-typeerror②">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">
   <a href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">4.1. Controlling a BLE scan</a> <a href="#ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys①">(2)</a> <a href="#ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys②">(3)</a> <a href="#ref-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-in-parallel">
   <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-in-parallel">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-queue-a-task">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-queue-a-task">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-relevant-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relevant-settings-object">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-responsible-event-loop">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-event-loop">https://html.spec.whatwg.org/multipage/webappapis.html#responsible-event-loop</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-responsible-event-loop">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-triggered-by-user-activation">
   <a href="https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation">https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-triggered-by-user-activation">4. Scanning for BLE advertisements</a> <a href="#ref-for-triggered-by-user-activation①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-permissionstate-denied">
   <a href="https://w3c.github.io/permissions/#dom-permissionstate-denied">https://w3c.github.io/permissions/#dom-permissionstate-denied</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionstate-denied">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-permissionstate-denied①">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-permissionstate-granted">
   <a href="https://w3c.github.io/permissions/#dom-permissionstate-granted">https://w3c.github.io/permissions/#dom-permissionstate-granted</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionstate-granted">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dictdef-permissiondescriptor">
   <a href="https://w3c.github.io/permissions/#dictdef-permissiondescriptor">https://w3c.github.io/permissions/#dictdef-permissiondescriptor</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-permissiondescriptor">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permissionstatus">
   <a href="https://w3c.github.io/permissions/#permissionstatus">https://w3c.github.io/permissions/#permissionstatus</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permissionstatus">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-extra-permission-data">
   <a href="https://w3c.github.io/permissions/#extra-permission-data">https://w3c.github.io/permissions/#extra-permission-data</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-extra-permission-data">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-descriptor-type">
   <a href="https://w3c.github.io/permissions/#permission-descriptor-type">https://w3c.github.io/permissions/#permission-descriptor-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-descriptor-type">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-query-algorithm">
   <a href="https://w3c.github.io/permissions/#permission-query-algorithm">https://w3c.github.io/permissions/#permission-query-algorithm</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-query-algorithm">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-result-type">
   <a href="https://w3c.github.io/permissions/#permission-result-type">https://w3c.github.io/permissions/#permission-result-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-result-type">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-revocation-algorithm">
   <a href="https://w3c.github.io/permissions/#permission-revocation-algorithm">https://w3c.github.io/permissions/#permission-revocation-algorithm</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-revocation-algorithm">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-state">
   <a href="https://w3c.github.io/permissions/#permission-state">https://w3c.github.io/permissions/#permission-state</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-state">4.2. Permission to scan</a> <a href="#ref-for-permission-state①">(2)</a> <a href="#ref-for-permission-state②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-powerful-feature">
   <a href="https://w3c.github.io/permissions/#powerful-feature">https://w3c.github.io/permissions/#powerful-feature</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-powerful-feature">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-request-permission-to-use">
   <a href="https://w3c.github.io/permissions/#request-permission-to-use">https://w3c.github.io/permissions/#request-permission-to-use</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-request-permission-to-use">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-permissionstatus-state">
   <a href="https://w3c.github.io/permissions/#dom-permissionstatus-state">https://w3c.github.io/permissions/#dom-permissionstatus-state</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionstatus-state">4.2. Permission to scan</a> <a href="#ref-for-dom-permissionstatus-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-request-algorithm">
   <a href="https://wicg.github.io/permissions-request/#permission-request-algorithm">https://wicg.github.io/permissions-request/#permission-request-algorithm</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-request-algorithm">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-a-new-promise">
   <a href="https://www.w3.org/2001/tag/doc/promises-guide/#a-new-promise">https://www.w3.org/2001/tag/doc/promises-guide/#a-new-promise</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-a-new-promise">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-reject-promise">
   <a href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise">https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-reject-promise">4. Scanning for BLE advertisements</a> <a href="#ref-for-reject-promise①">(2)</a> <a href="#ref-for-reject-promise②">(3)</a> <a href="#ref-for-reject-promise③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-secure-contexts">
   <a href="https://w3c.github.io/webappsec-secure-contexts/#secure-contexts">https://w3c.github.io/webappsec-secure-contexts/#secure-contexts</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-secure-contexts">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-permissionname-bluetooth">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-permissionname-bluetooth">https://webbluetoothcg.github.io/web-bluetooth/#dom-permissionname-bluetooth</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionname-bluetooth">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-bluetooth">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth">https://webbluetoothcg.github.io/web-bluetooth/#bluetooth</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetooth">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-bluetooth①">5.1. Responding to advertising events</a>
    <li><a href="#ref-for-bluetooth②">6. Changes to existing interfaces</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dictdef-bluetoothdatafilterinit">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothdatafilterinit">https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothdatafilterinit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-bluetoothdatafilterinit">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-bluetoothdevice">
   <a href="index.html#bluetoothdevice">index.html#bluetoothdevice</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothdevice">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-bluetoothdevice①">5.1. Responding to advertising events</a>
    <li><a href="#ref-for-bluetoothdevice②">6. Changes to existing interfaces</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dictdef-bluetoothlescanfilterinit">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit">https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-bluetoothlescanfilterinit">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dictdef-bluetoothlescanfilterinit①">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-dictdef-bluetoothlescanfilterinit②">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-typedefdef-uuid">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid">https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typedefdef-uuid">4.1. Controlling a BLE scan</a> <a href="#ref-for-typedefdef-uuid①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-eventdef-bluetoothdevice-advertisementreceived">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#eventdef-bluetoothdevice-advertisementreceived">https://webbluetoothcg.github.io/web-bluetooth/#eventdef-bluetoothdevice-advertisementreceived</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eventdef-bluetoothdevice-advertisementreceived">1.1. Examples</a>
    <li><a href="#ref-for-eventdef-bluetoothdevice-advertisementreceived①">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-bluetooth-device">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth-device">https://webbluetoothcg.github.io/web-bluetooth/#bluetooth-device</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetooth-device">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-bluetoothlescanfilterinit-canonicalizing">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing">https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescanfilterinit-canonicalizing">4.1. Controlling a BLE scan</a> <a href="#ref-for-bluetoothlescanfilterinit-canonicalizing①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothdatafilterinit-dataprefix">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-dataprefix">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-dataprefix</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdatafilterinit-dataprefix">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-fire-an-advertisementreceived-event">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#fire-an-advertisementreceived-event">https://webbluetoothcg.github.io/web-bluetooth/#fire-an-advertisementreceived-event</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fire-an-advertisementreceived-event">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-get-the-bluetoothdevice-representing">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#get-the-bluetoothdevice-representing">https://webbluetoothcg.github.io/web-bluetooth/#get-the-bluetoothdevice-representing</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-get-the-bluetoothdevice-representing">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothuuid-getservice">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothuuid-getservice">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothlescanfilterinit-manufacturerdata">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-manufacturerdata">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-manufacturerdata</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilterinit-manufacturerdata">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothdatafilterinit-mask">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-mask">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdatafilterinit-mask</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdatafilterinit-mask">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-bluetoothdatafilterinit-matches">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdatafilterinit-matches">https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdatafilterinit-matches</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothdatafilterinit-matches">5.1. Responding to advertising events</a> <a href="#ref-for-bluetoothdatafilterinit-matches①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-allowedbluetoothdevice-mayusegatt">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-allowedbluetoothdevice-mayusegatt">https://webbluetoothcg.github.io/web-bluetooth/#dom-allowedbluetoothdevice-mayusegatt</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-allowedbluetoothdevice-mayusegatt">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-read-only-arraybuffer">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#read-only-arraybuffer">https://webbluetoothcg.github.io/web-bluetooth/#read-only-arraybuffer</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-read-only-arraybuffer">4.1. Controlling a BLE scan</a> <a href="#ref-for-read-only-arraybuffer①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-same-bluetooth-device">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#same-bluetooth-device">https://webbluetoothcg.github.io/web-bluetooth/#same-bluetooth-device</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-same-bluetooth-device">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothlescanfilterinit-servicedata">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-servicedata">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-servicedata</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilterinit-servicedata">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-bluetoothlescanfilterinit-services">
   <a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-services">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothlescanfilterinit-services</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilterinit-services">4.1. Controlling a BLE scan</a> <a href="#ref-for-dom-bluetoothlescanfilterinit-services①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-ArrayBuffer">
   <a href="https://heycam.github.io/webidl/#idl-ArrayBuffer">https://heycam.github.io/webidl/#idl-ArrayBuffer</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-ArrayBuffer">4.1. Controlling a BLE scan</a> <a href="#ref-for-idl-ArrayBuffer①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-DOMString">
   <a href="https://heycam.github.io/webidl/#idl-DOMString">https://heycam.github.io/webidl/#idl-DOMString</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-DOMString">4.1. Controlling a BLE scan</a> <a href="#ref-for-idl-DOMString①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-frozen-array">
   <a href="https://heycam.github.io/webidl/#idl-frozen-array">https://heycam.github.io/webidl/#idl-frozen-array</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-frozen-array">4.2. Permission to scan</a> <a href="#ref-for-idl-frozen-array①">(2)</a> <a href="#ref-for-idl-frozen-array②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-invalidstateerror">
   <a href="https://heycam.github.io/webidl/#invalidstateerror">https://heycam.github.io/webidl/#invalidstateerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-invalidstateerror">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-notallowederror">
   <a href="https://heycam.github.io/webidl/#notallowederror">https://heycam.github.io/webidl/#notallowederror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-notallowederror">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-notsupportederror">
   <a href="https://heycam.github.io/webidl/#notsupportederror">https://heycam.github.io/webidl/#notsupportederror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-notsupportederror">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-SecureContext">
   <a href="https://heycam.github.io/webidl/#SecureContext">https://heycam.github.io/webidl/#SecureContext</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-SecureContext">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-unknownerror">
   <a href="https://heycam.github.io/webidl/#unknownerror">https://heycam.github.io/webidl/#unknownerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-unknownerror">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-get-buffer-source-copy">
   <a href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy">https://heycam.github.io/webidl/#dfn-get-buffer-source-copy</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-get-buffer-source-copy">4.1. Controlling a BLE scan</a> <a href="#ref-for-dfn-get-buffer-source-copy①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-boolean">
   <a href="https://heycam.github.io/webidl/#idl-boolean">https://heycam.github.io/webidl/#idl-boolean</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-boolean">4. Scanning for BLE advertisements</a> <a href="#ref-for-idl-boolean①">(2)</a>
    <li><a href="#ref-for-idl-boolean②">4.1. Controlling a BLE scan</a> <a href="#ref-for-idl-boolean③">(2)</a> <a href="#ref-for-idl-boolean④">(3)</a>
    <li><a href="#ref-for-idl-boolean⑤">4.2. Permission to scan</a> <a href="#ref-for-idl-boolean⑥">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-map-entries">
   <a href="https://heycam.github.io/webidl/#dfn-map-entries">https://heycam.github.io/webidl/#dfn-map-entries</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-map-entries">4.1. Controlling a BLE scan</a> <a href="#ref-for-dfn-map-entries①">(2)</a> <a href="#ref-for-dfn-map-entries②">(3)</a> <a href="#ref-for-dfn-map-entries③">(4)</a>
    <li><a href="#ref-for-dfn-map-entries④">5.1. Responding to advertising events</a> <a href="#ref-for-dfn-map-entries⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-object">
   <a href="https://heycam.github.io/webidl/#idl-object">https://heycam.github.io/webidl/#idl-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-object">4.1. Controlling a BLE scan</a> <a href="#ref-for-idl-object①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-present">
   <a href="https://heycam.github.io/webidl/#dfn-present">https://heycam.github.io/webidl/#dfn-present</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-present">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dfn-present①">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-unsigned-short">
   <a href="https://heycam.github.io/webidl/#idl-unsigned-short">https://heycam.github.io/webidl/#idl-unsigned-short</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-unsigned-short">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[ECMAScript]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-sec-array.prototype.map" style="color:initial">Array.prototype.map</span>
     <li><span class="dfn-paneled" id="term-for-sec-native-error-types-used-in-this-standard-typeerror" style="color:initial">TypeError</span>
     <li><span class="dfn-paneled" id="term-for-sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" style="color:initial">[[OwnPropertyKeys]]</span>
    </ul>
   <li>
    <a data-link-type="biblio">[HTML]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-in-parallel" style="color:initial">in parallel</span>
     <li><span class="dfn-paneled" id="term-for-queue-a-task" style="color:initial">queue a task</span>
     <li><span class="dfn-paneled" id="term-for-relevant-settings-object" style="color:initial">relevant settings object</span>
     <li><span class="dfn-paneled" id="term-for-responsible-event-loop" style="color:initial">responsible event loop</span>
     <li><span class="dfn-paneled" id="term-for-triggered-by-user-activation" style="color:initial">triggered by user activation</span>
    </ul>
   <li>
    <a data-link-type="biblio">[permissions]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-dom-permissionstate-denied" style="color:initial">"denied"</span>
     <li><span class="dfn-paneled" id="term-for-dom-permissionstate-granted" style="color:initial">"granted"</span>
     <li><span class="dfn-paneled" id="term-for-dictdef-permissiondescriptor" style="color:initial">PermissionDescriptor</span>
     <li><span class="dfn-paneled" id="term-for-permissionstatus" style="color:initial">PermissionStatus</span>
     <li><span class="dfn-paneled" id="term-for-extra-permission-data" style="color:initial">extra permission data</span>
     <li><span class="dfn-paneled" id="term-for-permission-descriptor-type" style="color:initial">permission descriptor type</span>
     <li><span class="dfn-paneled" id="term-for-permission-query-algorithm" style="color:initial">permission query algorithm</span>
     <li><span class="dfn-paneled" id="term-for-permission-result-type" style="color:initial">permission result type</span>
     <li><span class="dfn-paneled" id="term-for-permission-revocation-algorithm" style="color:initial">permission revocation algorithm</span>
     <li><span class="dfn-paneled" id="term-for-permission-state" style="color:initial">permission state</span>
     <li><span class="dfn-paneled" id="term-for-powerful-feature" style="color:initial">powerful feature</span>
     <li><span class="dfn-paneled" id="term-for-request-permission-to-use" style="color:initial">request permission to use</span>
     <li><span class="dfn-paneled" id="term-for-dom-permissionstatus-state" style="color:initial">state</span>
    </ul>
   <li>
    <a data-link-type="biblio">[PERMISSIONS-REQUEST]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-permission-request-algorithm" style="color:initial">permission request algorithm</span>
    </ul>
   <li>
    <a data-link-type="biblio">[promises-guide]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-a-new-promise" style="color:initial">a new promise</span>
     <li><span class="dfn-paneled" id="term-for-reject-promise" style="color:initial">reject</span>
    </ul>
   <li>
    <a data-link-type="biblio">[secure-contexts]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-secure-contexts" style="color:initial">secure contexts</span>
    </ul>
   <li>
    <a data-link-type="biblio">[web-bluetooth]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-dom-permissionname-bluetooth" style="color:initial">"bluetooth"</span>
     <li><span class="dfn-paneled" id="term-for-bluetooth" style="color:initial">Bluetooth</span>
     <li><span class="dfn-paneled" id="term-for-dictdef-bluetoothdatafilterinit" style="color:initial">BluetoothDataFilterInit</span>
     <li><span class="dfn-paneled" id="term-for-bluetoothdevice" style="color:initial">BluetoothDevice</span>
     <li><span class="dfn-paneled" id="term-for-dictdef-bluetoothlescanfilterinit" style="color:initial">BluetoothLEScanFilterInit</span>
     <li><span class="dfn-paneled" id="term-for-typedefdef-uuid" style="color:initial">UUID</span>
     <li><span class="dfn-paneled" id="term-for-eventdef-bluetoothdevice-advertisementreceived" style="color:initial">advertisementreceived</span>
     <li><span class="dfn-paneled" id="term-for-bluetooth-device" style="color:initial">bluetooth device</span>
     <li><span class="dfn-paneled" id="term-for-bluetoothlescanfilterinit-canonicalizing" style="color:initial">canonicalizing <small>(for BluetoothLEScanFilterInit)</small></span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothdatafilterinit-dataprefix" style="color:initial">dataPrefix</span>
     <li><span class="dfn-paneled" id="term-for-fire-an-advertisementreceived-event" style="color:initial">fire an advertisementreceived event</span>
     <li><span class="dfn-paneled" id="term-for-get-the-bluetoothdevice-representing" style="color:initial">get the bluetoothdevice representing</span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothuuid-getservice" style="color:initial">getService(name)</span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothlescanfilterinit-manufacturerdata" style="color:initial">manufacturerData</span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothdatafilterinit-mask" style="color:initial">mask</span>
     <li><span class="dfn-paneled" id="term-for-bluetoothdatafilterinit-matches" style="color:initial">matches</span>
     <li><span class="dfn-paneled" id="term-for-dom-allowedbluetoothdevice-mayusegatt" style="color:initial">mayUseGATT</span>
     <li><span class="dfn-paneled" id="term-for-read-only-arraybuffer" style="color:initial">read only arraybuffer</span>
     <li><span class="dfn-paneled" id="term-for-same-bluetooth-device" style="color:initial">same bluetooth device</span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothlescanfilterinit-servicedata" style="color:initial">serviceData</span>
     <li><span class="dfn-paneled" id="term-for-dom-bluetoothlescanfilterinit-services" style="color:initial">services</span>
    </ul>
   <li>
    <a data-link-type="biblio">[WebIDL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-idl-ArrayBuffer" style="color:initial">ArrayBuffer</span>
     <li><span class="dfn-paneled" id="term-for-idl-DOMString" style="color:initial">DOMString</span>
     <li><span class="dfn-paneled" id="term-for-idl-frozen-array" style="color:initial">FrozenArray</span>
     <li><span class="dfn-paneled" id="term-for-invalidstateerror" style="color:initial">InvalidStateError</span>
     <li><span class="dfn-paneled" id="term-for-notallowederror" style="color:initial">NotAllowedError</span>
     <li><span class="dfn-paneled" id="term-for-notsupportederror" style="color:initial">NotSupportedError</span>
     <li><span class="dfn-paneled" id="term-for-SecureContext" style="color:initial">SecureContext</span>
     <li><span class="dfn-paneled" id="term-for-unknownerror" style="color:initial">UnknownError</span>
     <li><span class="dfn-paneled" id="term-for-dfn-get-buffer-source-copy" style="color:initial">a copy of the bytes held</span>
     <li><span class="dfn-paneled" id="term-for-idl-boolean" style="color:initial">boolean</span>
     <li><span class="dfn-paneled" id="term-for-dfn-map-entries" style="color:initial">map entries</span>
     <li><span class="dfn-paneled" id="term-for-idl-object" style="color:initial">object</span>
     <li><span class="dfn-paneled" id="term-for-dfn-present" style="color:initial">present</span>
     <li><span class="dfn-paneled" id="term-for-idl-unsigned-short" style="color:initial">unsigned short</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-bluetooth-supplement6">[BLUETOOTH-SUPPLEMENT6]
   <dd><a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=302735">Supplement to the Bluetooth Core Specification Version 6</a>. 14 July 2015. URL: <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=302735">https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=302735</a>
   <dt id="biblio-bluetooth42">[BLUETOOTH42]
   <dd><a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439">BLUETOOTH SPECIFICATION Version 4.2</a>. 2 December 2014. URL: <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439">https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439</a>
   <dt id="biblio-ecmascript">[ECMAScript]
   <dd><a href="https://tc39.github.io/ecma262/">ECMAScript Language Specification</a>. URL: <a href="https://tc39.github.io/ecma262/">https://tc39.github.io/ecma262/</a>
   <dt id="biblio-html">[HTML]
   <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
   <dt id="biblio-permissions">[PERMISSIONS]
   <dd>Mounir Lamouri; Marcos Caceres; Jeffrey Yasskin. <a href="https://www.w3.org/TR/permissions/">Permissions</a>. 25 September 2017. WD. URL: <a href="https://www.w3.org/TR/permissions/">https://www.w3.org/TR/permissions/</a>
   <dt id="biblio-permissions-request">[PERMISSIONS-REQUEST]
   <dd><a href="https://wicg.github.io/permissions-request/">Requesting Permissions</a>. Living Standard. URL: <a href="https://wicg.github.io/permissions-request/">https://wicg.github.io/permissions-request/</a>
   <dt id="biblio-promises-guide">[PROMISES-GUIDE]
   <dd>Domenic Denicola. <a href="https://www.w3.org/2001/tag/doc/promises-guide">Writing Promise-Using Specifications</a>. 9 November 2018. TAG Finding. URL: <a href="https://www.w3.org/2001/tag/doc/promises-guide">https://www.w3.org/2001/tag/doc/promises-guide</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
   <dt id="biblio-web-bluetooth">[WEB-BLUETOOTH]
   <dd>Jeffrey Yasskin. <a href="https://webbluetoothcg.github.io/web-bluetooth/">Web Bluetooth</a>. Draft Community Group Report. URL: <a href="https://webbluetoothcg.github.io/web-bluetooth/">https://webbluetoothcg.github.io/web-bluetooth/</a>
   <dt id="biblio-webidl">[WebIDL]
   <dd>Boris Zbarsky. <a href="https://heycam.github.io/webidl/">Web IDL</a>. 15 December 2016. ED. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-geolocation-api">[GEOLOCATION-API]
   <dd>Andrei Popescu. <a href="https://www.w3.org/TR/geolocation-API/">Geolocation API Specification 2nd Edition</a>. 8 November 2016. REC. URL: <a href="https://www.w3.org/TR/geolocation-API/">https://www.w3.org/TR/geolocation-API/</a>
   <dt id="biblio-secure-contexts">[SECURE-CONTEXTS]
   <dd>Mike West. <a href="https://www.w3.org/TR/secure-contexts/">Secure Contexts</a>. 15 September 2016. CR. URL: <a href="https://www.w3.org/TR/secure-contexts/">https://www.w3.org/TR/secure-contexts/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def"><c- b>dictionary</c-> <a href="#dictdef-bluetoothlescanoptions"><code><c- g>BluetoothLEScanOptions</c-></code></a> {
  <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit③"><c- n>BluetoothLEScanFilterInit</c-></a>> <a data-type="sequence<BluetoothLEScanFilterInit> " href="#dom-bluetoothlescanoptions-filters"><code><c- g>filters</c-></code></a>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean⑦"><c- b>boolean</c-></a> <a class="idl-code" data-default="false" data-link-type="dict-member" data-type="boolean " href="#dom-bluetoothlescanoptions-keeprepeateddevices" id="ref-for-dom-bluetoothlescanoptions-keeprepeateddevices③"><c- g>keepRepeatedDevices</c-></a> = <c- b>false</c->;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①①"><c- b>boolean</c-></a> <a class="idl-code" data-default="false" data-link-type="dict-member" data-type="boolean " href="#dom-bluetoothlescanoptions-acceptalladvertisements" id="ref-for-dom-bluetoothlescanoptions-acceptalladvertisements②"><c- g>acceptAllAdvertisements</c-></a> = <c- b>false</c->;
};

<c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://webbluetoothcg.github.io/web-bluetooth/#bluetooth" id="ref-for-bluetooth③"><c- g>Bluetooth</c-></a> {
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext①"><c- g>SecureContext</c-></a>]
  <c- b>Promise</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescan" id="ref-for-bluetoothlescan①⓪"><c- n>BluetoothLEScan</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-bluetooth-requestlescan" id="ref-for-dom-bluetooth-requestlescan①①"><c- g>requestLEScan</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dictdef-bluetoothlescanoptions" id="ref-for-dictdef-bluetoothlescanoptions①"><c- n>BluetoothLEScanOptions</c-></a> <a href="#dom-bluetooth-requestlescan-options-options"><code><c- g>options</c-></code></a>);
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothdatafilter-bluetoothdatafilter" id="ref-for-dom-bluetoothdatafilter-bluetoothdatafilter①"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothdatafilterinit" id="ref-for-dictdef-bluetoothdatafilterinit①"><c- n>BluetoothDataFilterInit</c-></a> <a href="#dom-bluetoothdatafilter-bluetoothdatafilter-init-init"><code><c- g>init</c-></code></a>)]
<c- b>interface</c-> <a href="#bluetoothdatafilter"><code><c- g>BluetoothDataFilter</c-></code></a> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer②"><c- b>ArrayBuffer</c-></a> <a data-readonly data-type="ArrayBuffer" href="#dom-bluetoothdatafilter-dataprefix"><code><c- g>dataPrefix</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer①①"><c- b>ArrayBuffer</c-></a> <a data-readonly data-type="ArrayBuffer" href="#dom-bluetoothdatafilter-mask"><code><c- g>mask</c-></code></a>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter" id="ref-for-dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter①"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-object" id="ref-for-idl-object②"><c- b>object</c-></a> <a href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter-init-init"><code><c- g>init</c-></code></a>)]
<c- b>interface</c-> <a href="#bluetoothmanufacturerdatafilter"><code><c- g>BluetoothManufacturerDataFilter</c-></code></a> {
  <c- b>readonly</c-> <c- b>maplike</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short①"><c- b>unsigned</c-> <c- b>short</c-></a>, <a class="n" data-link-type="idl-name" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter④"><c- n>BluetoothDataFilter</c-></a>>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter" id="ref-for-dom-bluetoothservicedatafilter-bluetoothservicedatafilter①"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-object" id="ref-for-idl-object①①"><c- b>object</c-></a> <a href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter-init-init"><code><c- g>init</c-></code></a>)]
<c- b>interface</c-> <a href="#bluetoothservicedatafilter"><code><c- g>BluetoothServiceDataFilter</c-></code></a> {
  <c- b>readonly</c-> <c- b>maplike</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid" id="ref-for-typedefdef-uuid②"><c- n>UUID</c-></a>, <a class="n" data-link-type="idl-name" href="#bluetoothdatafilter" id="ref-for-bluetoothdatafilter①①"><c- n>BluetoothDataFilter</c-></a>>;
};

[<a class="idl-code" data-link-type="constructor" href="#dom-bluetoothlescanfilter-bluetoothlescanfilter" id="ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter①①"><c- g>Constructor</c-></a>(<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit①①"><c- n>BluetoothLEScanFilterInit</c-></a> <a href="#dom-bluetoothlescanfilter-bluetoothlescanfilter-init-init"><code><c- g>init</c-></code></a>)]
<c- b>interface</c-> <a href="#bluetoothlescanfilter"><code><c- g>BluetoothLEScanFilter</c-></code></a> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString②"><c- b>DOMString</c-></a>? <a data-readonly data-type="DOMString?" href="#dom-bluetoothlescanfilter-name"><code><c- g>name</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①①"><c- b>DOMString</c-></a>? <a data-readonly data-type="DOMString?" href="#dom-bluetoothlescanfilter-nameprefix"><code><c- g>namePrefix</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-uuid" id="ref-for-typedefdef-uuid①①"><c- n>UUID</c-></a>>? <a data-readonly data-type="FrozenArray<UUID>?" href="#dom-bluetoothlescanfilter-services"><code><c- g>services</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#bluetoothmanufacturerdatafilter" id="ref-for-bluetoothmanufacturerdatafilter①"><c- n>BluetoothManufacturerDataFilter</c-></a> <a data-readonly data-type="BluetoothManufacturerDataFilter" href="#dom-bluetoothlescanfilter-manufacturerdata"><code><c- g>manufacturerData</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#bluetoothservicedatafilter" id="ref-for-bluetoothservicedatafilter①"><c- n>BluetoothServiceDataFilter</c-></a> <a data-readonly data-type="BluetoothServiceDataFilter" href="#dom-bluetoothlescanfilter-servicedata"><code><c- g>serviceData</c-></code></a>;
};

<c- b>interface</c-> <a href="#bluetoothlescan"><code><c- g>BluetoothLEScan</c-></code></a> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescanfilter" id="ref-for-bluetoothlescanfilter①①"><c- n>BluetoothLEScanFilter</c-></a>> <a data-readonly data-type="FrozenArray<BluetoothLEScanFilter>" href="#dom-bluetoothlescan-filters"><code><c- g>filters</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean②①"><c- b>boolean</c-></a> <a data-readonly data-type="boolean" href="#dom-bluetoothlescan-keeprepeateddevices"><code><c- g>keepRepeatedDevices</c-></code></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean③①"><c- b>boolean</c-></a> <a data-readonly data-type="boolean" href="#dom-bluetoothlescan-acceptalladvertisements"><code><c- g>acceptAllAdvertisements</c-></code></a>;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean④①"><c- b>boolean</c-></a> <a data-readonly data-type="boolean" href="#dom-bluetoothlescan-active"><code><c- g>active</c-></code></a>;

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-bluetoothlescan-stop" id="ref-for-dom-bluetoothlescan-stop③"><c- g>stop</c-></a>();
};

<c- b>dictionary</c-> <a href="#dictdef-bluetoothlescanpermissiondescriptor"><code><c- g>BluetoothLEScanPermissionDescriptor</c-></code></a> : <a class="n" data-link-type="idl-name" href="https://w3c.github.io/permissions/#dictdef-permissiondescriptor" id="ref-for-dictdef-permissiondescriptor①"><c- n>PermissionDescriptor</c-></a> {
  // These match BluetoothLEScanOptions.
  <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="https://webbluetoothcg.github.io/web-bluetooth/#dictdef-bluetoothlescanfilterinit" id="ref-for-dictdef-bluetoothlescanfilterinit②①"><c- n>BluetoothLEScanFilterInit</c-></a>> <a data-type="sequence<BluetoothLEScanFilterInit> " href="#dom-bluetoothlescanpermissiondescriptor-filters"><code><c- g>filters</c-></code></a>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean⑤①"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean " href="#dom-bluetoothlescanpermissiondescriptor-keeprepeateddevices"><code><c- g>keepRepeatedDevices</c-></code></a> = <c- b>false</c->;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean⑥①"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean " href="#dom-bluetoothlescanpermissiondescriptor-acceptalladvertisements"><code><c- g>acceptAllAdvertisements</c-></code></a> = <c- b>false</c->;
};

<c- b>interface</c-> <a href="#bluetoothlescanpermissionresult"><code><c- g>BluetoothLEScanPermissionResult</c-></code></a> : <a class="n" data-link-type="idl-name" href="https://w3c.github.io/permissions/#permissionstatus" id="ref-for-permissionstatus①"><c- n>PermissionStatus</c-></a> {
  <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a class="n" data-link-type="idl-name" href="#bluetoothlescan" id="ref-for-bluetoothlescan④①"><c- n>BluetoothLEScan</c-></a>> <a data-type="FrozenArray<BluetoothLEScan>" href="#dom-bluetoothlescanpermissionresult-scans"><code><c- g>scans</c-></code></a>;
};

</pre>
  <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
  <div style="counter-reset:issue">
   <div class="issue"> Find wording that allows the UA to limit its scan to only certain periods of time,
          to save power. <a href="#issue-limit-scan-periods"> ↵ </a></div>
   <div class="issue"> Consider filtering the result to active scans that
              match the fields of the descriptor. <a href="#issue-should-query-filter"> ↵ </a></div>
  </div>
  <aside class="dfn-panel" data-for="dictdef-bluetoothlescanoptions">
   <b><a href="#dictdef-bluetoothlescanoptions">#dictdef-bluetoothlescanoptions</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-bluetoothlescanoptions">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanoptions-keeprepeateddevices">
   <b><a href="#dom-bluetoothlescanoptions-keeprepeateddevices">#dom-bluetoothlescanoptions-keeprepeateddevices</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanoptions-keeprepeateddevices">4. Scanning for BLE advertisements</a> <a href="#ref-for-dom-bluetoothlescanoptions-keeprepeateddevices①">(2)</a>
    <li><a href="#ref-for-dom-bluetoothlescanoptions-keeprepeateddevices②">6. Changes to existing interfaces</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanoptions-acceptalladvertisements">
   <b><a href="#dom-bluetoothlescanoptions-acceptalladvertisements">#dom-bluetoothlescanoptions-acceptalladvertisements</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanoptions-acceptalladvertisements">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-bluetoothlescanoptions-acceptalladvertisements①">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetooth-requestlescan">
   <b><a href="#dom-bluetooth-requestlescan">#dom-bluetooth-requestlescan</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetooth-requestlescan">1.1. Examples</a>
    <li><a href="#ref-for-dom-bluetooth-requestlescan①">4. Scanning for BLE advertisements</a> <a href="#ref-for-dom-bluetooth-requestlescan②">(2)</a> <a href="#ref-for-dom-bluetooth-requestlescan③">(3)</a>
    <li><a href="#ref-for-dom-bluetooth-requestlescan④">4.2. Permission to scan</a>
    <li><a href="#ref-for-dom-bluetooth-requestlescan⑤">7. Terminology and conventions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothdatafilter">
   <b><a href="#bluetoothdatafilter">#bluetoothdatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothdatafilter">4.1. Controlling a BLE scan</a> <a href="#ref-for-bluetoothdatafilter①">(2)</a> <a href="#ref-for-bluetoothdatafilter②">(3)</a> <a href="#ref-for-bluetoothdatafilter③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothdatafilter-dataprefix">
   <b><a href="#dom-bluetoothdatafilter-dataprefix">#dom-bluetoothdatafilter-dataprefix</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdatafilter-dataprefix">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothdatafilter-mask">
   <b><a href="#dom-bluetoothdatafilter-mask">#dom-bluetoothdatafilter-mask</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdatafilter-mask">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothmanufacturerdatafilter">
   <b><a href="#bluetoothmanufacturerdatafilter">#bluetoothmanufacturerdatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothmanufacturerdatafilter">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothservicedatafilter">
   <b><a href="#bluetoothservicedatafilter">#bluetoothservicedatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothservicedatafilter">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothlescanfilter">
   <b><a href="#bluetoothlescanfilter">#bluetoothlescanfilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescanfilter">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-bluetoothlescanfilter①">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-bluetoothlescanfilter②">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanfilter-name">
   <b><a href="#dom-bluetoothlescanfilter-name">#dom-bluetoothlescanfilter-name</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-name">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanfilter-services">
   <b><a href="#dom-bluetoothlescanfilter-services">#dom-bluetoothlescanfilter-services</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-services">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanfilter-manufacturerdata">
   <b><a href="#dom-bluetoothlescanfilter-manufacturerdata">#dom-bluetoothlescanfilter-manufacturerdata</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-manufacturerdata">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanfilter-servicedata">
   <b><a href="#dom-bluetoothlescanfilter-servicedata">#dom-bluetoothlescanfilter-servicedata</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-servicedata">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothlescan">
   <b><a href="#bluetoothlescan">#bluetoothlescan</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescan">4. Scanning for BLE advertisements</a> <a href="#ref-for-bluetoothlescan①">(2)</a> <a href="#ref-for-bluetoothlescan②">(3)</a>
    <li><a href="#ref-for-bluetoothlescan③">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-bluetoothlescan④">4.2. Permission to scan</a>
    <li><a href="#ref-for-bluetoothlescan⑤">5.1. Responding to advertising events</a> <a href="#ref-for-bluetoothlescan⑥">(2)</a> <a href="#ref-for-bluetoothlescan⑦">(3)</a>
    <li><a href="#ref-for-bluetoothlescan⑧">6. Changes to existing interfaces</a> <a href="#ref-for-bluetoothlescan⑨">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescan-filters">
   <b><a href="#dom-bluetoothlescan-filters">#dom-bluetoothlescan-filters</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescan-filters">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-bluetoothlescan-filters①">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescan-keeprepeateddevices">
   <b><a href="#dom-bluetoothlescan-keeprepeateddevices">#dom-bluetoothlescan-keeprepeateddevices</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescan-keeprepeateddevices">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-bluetoothlescan-keeprepeateddevices①">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescan-acceptalladvertisements">
   <b><a href="#dom-bluetoothlescan-acceptalladvertisements">#dom-bluetoothlescan-acceptalladvertisements</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescan-acceptalladvertisements">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescan-active">
   <b><a href="#dom-bluetoothlescan-active">#dom-bluetoothlescan-active</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescan-active">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-bluetoothlescan-active①">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-dom-bluetoothlescan-active②">6. Changes to existing interfaces</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanfilter-bluetoothlescanfilter">
   <b><a href="#dom-bluetoothlescanfilter-bluetoothlescanfilter">#dom-bluetoothlescanfilter-bluetoothlescanfilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter①">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter②">7. Terminology and conventions</a> <a href="#ref-for-dom-bluetoothlescanfilter-bluetoothlescanfilter③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescan-stop">
   <b><a href="#dom-bluetoothlescan-stop">#dom-bluetoothlescan-stop</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescan-stop">4.1. Controlling a BLE scan</a> <a href="#ref-for-dom-bluetoothlescan-stop①">(2)</a>
    <li><a href="#ref-for-dom-bluetoothlescan-stop②">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter">
   <b><a href="#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter">#dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothmanufacturerdatafilter-bluetoothmanufacturerdatafilter">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothservicedatafilter-bluetoothservicedatafilter">
   <b><a href="#dom-bluetoothservicedatafilter-bluetoothservicedatafilter">#dom-bluetoothservicedatafilter-bluetoothservicedatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothservicedatafilter-bluetoothservicedatafilter">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothdatafilter-bluetoothdatafilter">
   <b><a href="#dom-bluetoothdatafilter-bluetoothdatafilter">#dom-bluetoothdatafilter-bluetoothdatafilter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdatafilter-bluetoothdatafilter">4.1. Controlling a BLE scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-permissionname-bluetooth-le-scan">
   <b><a href="#dom-permissionname-bluetooth-le-scan">#dom-permissionname-bluetooth-le-scan</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionname-bluetooth-le-scan">4. Scanning for BLE advertisements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dictdef-bluetoothlescanpermissiondescriptor">
   <b><a href="#dictdef-bluetoothlescanpermissiondescriptor">#dictdef-bluetoothlescanpermissiondescriptor</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-bluetoothlescanpermissiondescriptor">4.2. Permission to scan</a> <a href="#ref-for-dictdef-bluetoothlescanpermissiondescriptor①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothlescanpermissionresult">
   <b><a href="#bluetoothlescanpermissionresult">#bluetoothlescanpermissionresult</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescanpermissionresult">4.2. Permission to scan</a> <a href="#ref-for-bluetoothlescanpermissionresult①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothlescanpermissionresult-scans">
   <b><a href="#dom-bluetoothlescanpermissionresult-scans">#dom-bluetoothlescanpermissionresult-scans</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothlescanpermissionresult-scans">4.2. Permission to scan</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothlescan-match">
   <b><a href="#bluetoothlescan-match">#bluetoothlescan-match</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescan-match">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-bluetoothlescan-match①">4.1. Controlling a BLE scan</a>
    <li><a href="#ref-for-bluetoothlescan-match②">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bluetoothlescanfilter-match">
   <b><a href="#bluetoothlescanfilter-match">#bluetoothlescanfilter-match</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bluetoothlescanfilter-match">4. Scanning for BLE advertisements</a>
    <li><a href="#ref-for-bluetoothlescanfilter-match①">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetooth-activescans-slot">
   <b><a href="#dom-bluetooth-activescans-slot">#dom-bluetooth-activescans-slot</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetooth-activescans-slot">4. Scanning for BLE advertisements</a> <a href="#ref-for-dom-bluetooth-activescans-slot①">(2)</a> <a href="#ref-for-dom-bluetooth-activescans-slot②">(3)</a>
    <li><a href="#ref-for-dom-bluetooth-activescans-slot③">4.1. Controlling a BLE scan</a> <a href="#ref-for-dom-bluetooth-activescans-slot④">(2)</a>
    <li><a href="#ref-for-dom-bluetooth-activescans-slot⑤">4.2. Permission to scan</a> <a href="#ref-for-dom-bluetooth-activescans-slot⑥">(2)</a>
    <li><a href="#ref-for-dom-bluetooth-activescans-slot⑦">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-bluetoothdevice-returnedfromscans-slot">
   <b><a href="#dom-bluetoothdevice-returnedfromscans-slot">#dom-bluetoothdevice-returnedfromscans-slot</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-bluetoothdevice-returnedfromscans-slot">5.1. Responding to advertising events</a> <a href="#ref-for-dom-bluetoothdevice-returnedfromscans-slot①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="advertising-event">
   <b><a href="#advertising-event">#advertising-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-advertising-event">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="observer">
   <b><a href="#observer">#observer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-observer">1. Introduction</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="privacy-feature">
   <b><a href="#privacy-feature">#privacy-feature</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-privacy-feature">2. Privacy considerations</a> <a href="#ref-for-privacy-feature①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="privacy-feature-in-an-observer">
   <b><a href="#privacy-feature-in-an-observer">#privacy-feature-in-an-observer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-privacy-feature-in-an-observer">2. Privacy considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="device-address">
   <b><a href="#device-address">#device-address</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-device-address">2. Privacy considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="passive-scanning">
   <b><a href="#passive-scanning">#passive-scanning</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-passive-scanning">2. Privacy considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="active-scanning">
   <b><a href="#active-scanning">#active-scanning</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-active-scanning">2. Privacy considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="service-uuid">
   <b><a href="#service-uuid">#service-uuid</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-service-uuid">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="local-name">
   <b><a href="#local-name">#local-name</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-local-name">5.1. Responding to advertising events</a> <a href="#ref-for-local-name①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="shortened-local-name">
   <b><a href="#shortened-local-name">#shortened-local-name</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-shortened-local-name">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="manufacturer-specific-data">
   <b><a href="#manufacturer-specific-data">#manufacturer-specific-data</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-manufacturer-specific-data">5.1. Responding to advertising events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="service-data">
   <b><a href="#service-data">#service-data</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-service-data">5.1. Responding to advertising events</a>
   </ul>
  </aside>
<script>/* script-var-click-highlighting */

    document.addEventListener("click", e=>{
        if(e.target.nodeName == "VAR") {
            highlightSameAlgoVars(e.target);
        }
    });
    {
        const indexCounts = new Map();
        const indexNames = new Map();
        function highlightSameAlgoVars(v) {
            // Find the algorithm container.
            let algoContainer = null;
            let searchEl = v;
            while(algoContainer == null && searchEl != document.body) {
                searchEl = searchEl.parentNode;
                if(searchEl.hasAttribute("data-algorithm")) {
                    algoContainer = searchEl;
                }
            }

            // Not highlighting document-global vars,
            // too likely to be unrelated.
            if(algoContainer == null) return;

            const algoName = algoContainer.getAttribute("data-algorithm");
            const varName = getVarName(v);
            const addClass = !v.classList.contains("selected");
            let highlightClass = null;
            if(addClass) {
                const index = chooseHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] += 1;
                indexNames.set(algoName+"///"+varName, index);
                highlightClass = nameFromIndex(index);
            } else {
                const index = previousHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] -= 1;
                highlightClass = nameFromIndex(index);
            }

            // Find all same-name vars, and toggle their class appropriately.
            for(const el of algoContainer.querySelectorAll("var")) {
                if(getVarName(el) == varName) {
                    el.classList.toggle("selected", addClass);
                    el.classList.toggle(highlightClass, addClass);
                }
            }
        }
        function getVarName(el) {
            return el.textContent.replace(/(\s| )+/, " ").trim();
        }
        function chooseHighlightIndex(algoName, varName) {
            let indexes = null;
            if(indexCounts.has(algoName)) {
                indexes = indexCounts.get(algoName);
            } else {
                // 7 classes right now
                indexes = [0,0,0,0,0,0,0];
                indexCounts.set(algoName, indexes);
            }

            // If the element was recently unclicked,
            // *and* that color is still unclaimed,
            // give it back the same color.
            const lastIndex = previousHighlightIndex(algoName, varName);
            if(indexes[lastIndex] === 0) return lastIndex;

            // Find the earliest index with the lowest count.
            const minCount = Math.min.apply(null, indexes);
            let index = null;
            for(var i = 0; i < indexes.length; i++) {
                if(indexes[i] == minCount) {
                    return i;
                }
            }
        }
        function previousHighlightIndex(algoName, varName) {
            return indexNames.get(algoName+"///"+varName);
        }
        function nameFromIndex(index) {
            return "selected" + index;
        }
    }
    </script>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>